Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > The right URL, server.transfer

Reply
Thread Tools

The right URL, server.transfer

 
 
Fabrice
Guest
Posts: n/a
 
      02-04-2006
Hello

Does a solution exist to get always the right path when you use
Server.Transfer in web application (version 1.1) ?

I want to rewrite my URL by use Global.asax and Application_BeginRequest
Sub. But as i use server.transfer in my web application i get always the old
URL even if
i use the property "HttpContext.Current.Request.CurrentExecutionFileP ath".

My global.asax

....
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

Dim myCurrentURL As String =
HttpContext.Current.Request.CurrentExecutionFilePa th
....

End Sub

But it seems not to work with server.tranfser property. I always get the
old URL.
For example, If I transfer a user to the page2.aspx from the page1.aspx by
use of server.transfer property, I will get "page1.aspx" as result with the
property HttpContext.Current.Request.CurrentExecutionFilePa th .... although
i m really on the page2.aspx

If i place the same code in the SUB LOAD of each page i get the right URL.

So if someone can help me....

thanks a lot.


 
Reply With Quote
 
 
 
 
S. Justin Gengo [MCP]
Guest
Posts: n/a
 
      02-04-2006
Fabrice,

That's because of the order of execution the Begin Request is firing when
the client posts to the server with the old url. Unless the client is
contacted again and told to request the new page (e.g. Response.Redirect)
the first request into the Global.asax will always use the old url.
Server.Transfer then executes the new page instead of the old one, but the
Global.asax file is not hit again because the client has not made a new
request. I'm afraid you'll need to re-think your solution. If you need to
use Server.Transfer instead of Response.Redirect then you'll need to access
HttpContext.Current.Request.CurrentExecutionFilePa th at the page level.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Fabrice" <(E-Mail Removed)> wrote in message
news:eIuZ%(E-Mail Removed)...
> Hello
>
> Does a solution exist to get always the right path when you use
> Server.Transfer in web application (version 1.1) ?
>
> I want to rewrite my URL by use Global.asax and Application_BeginRequest
> Sub. But as i use server.transfer in my web application i get always the
> old URL even if
> i use the property
> "HttpContext.Current.Request.CurrentExecutionFileP ath".
>
> My global.asax
>
> ...
> Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
>
> Dim myCurrentURL As String =
> HttpContext.Current.Request.CurrentExecutionFilePa th
> ...
>
> End Sub
>
> But it seems not to work with server.tranfser property. I always get the
> old URL.
> For example, If I transfer a user to the page2.aspx from the page1.aspx
> by use of server.transfer property, I will get "page1.aspx" as result with
> the property HttpContext.Current.Request.CurrentExecutionFilePa th ....
> although i m really on the page2.aspx
>
> If i place the same code in the SUB LOAD of each page i get the right URL.
>
> So if someone can help me....
>
> thanks a lot.
>



 
Reply With Quote
 
 
 
 
Fabrice
Guest
Posts: n/a
 
      02-04-2006
Hi Justin,

Thanks for your help and your explanation.
I think i have to re-think a part of my application if i want to apply
rewriting solution... .!

Have a nice week end.

fabrice.


"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> a écrit
dans le message de news: O%(E-Mail Removed)...
> Fabrice,
>
> That's because of the order of execution the Begin Request is firing when
> the client posts to the server with the old url. Unless the client is
> contacted again and told to request the new page (e.g. Response.Redirect)
> the first request into the Global.asax will always use the old url.
> Server.Transfer then executes the new page instead of the old one, but the
> Global.asax file is not hit again because the client has not made a new
> request. I'm afraid you'll need to re-think your solution. If you need to
> use Server.Transfer instead of Response.Redirect then you'll need to
> access HttpContext.Current.Request.CurrentExecutionFilePa th at the page
> level.
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "Fabrice" <(E-Mail Removed)> wrote in message
> news:eIuZ%(E-Mail Removed)...
>> Hello
>>
>> Does a solution exist to get always the right path when you use
>> Server.Transfer in web application (version 1.1) ?
>>
>> I want to rewrite my URL by use Global.asax and Application_BeginRequest
>> Sub. But as i use server.transfer in my web application i get always the
>> old URL even if
>> i use the property
>> "HttpContext.Current.Request.CurrentExecutionFileP ath".
>>
>> My global.asax
>>
>> ...
>> Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
>> EventArgs)
>>
>> Dim myCurrentURL As String =
>> HttpContext.Current.Request.CurrentExecutionFilePa th
>> ...
>>
>> End Sub
>>
>> But it seems not to work with server.tranfser property. I always get the
>> old URL.
>> For example, If I transfer a user to the page2.aspx from the page1.aspx
>> by use of server.transfer property, I will get "page1.aspx" as result
>> with the property HttpContext.Current.Request.CurrentExecutionFilePa th
>> .... although i m really on the page2.aspx
>>
>> If i place the same code in the SUB LOAD of each page i get the right
>> URL.
>>
>> So if someone can help me....
>>
>> thanks a lot.
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Menu Items is not right aligned with Right to Left documen =?Utf-8?B?QmlzaG95?= ASP .Net 0 12-28-2006 11:39 AM
Right-Click With Mouse and Toolba Buttonsr Don't Work Right Bigfoot It Is Computer Support 0 10-30-2006 06:08 PM
Tool to enable Right click on pages where Right click is disabled tsteinke@gmail.com Computer Support 4 08-28-2005 11:53 PM
Tool to right click image in windows explorer and rotate image right or left 90 degrees siliconpi Digital Photography 2 11-29-2004 12:56 PM
pass the right form input to the right control Tom ASP .Net 0 12-11-2003 03:07 AM



Advertisments