473,499 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The right URL, server.transfer

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.
Feb 4 '06 #1
2 1673
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" <em******@spam-infonie.fr> wrote in message
news:eI****************@TK2MSFTNGP10.phx.gbl...
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.

Feb 4 '06 #2
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%***************@TK2MSFTNGP14.phx.gbl...
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" <em******@spam-infonie.fr> wrote in message
news:eI****************@TK2MSFTNGP10.phx.gbl...
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.


Feb 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4589
by: Mark | last post by:
Hello I'm trying to use a Server.Transfer in a try-catch (I cannot put it outside the Try-Catch as it is nested deep within a component that is called in a try-catch loop) The problem is that the...
11
5993
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it...
1
521
by: Alexander Bosch | last post by:
Hi, I'm sorry for the double posting, but I haven't got any solution for this and I'm still puzzled by this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 that's saying this...
8
3869
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.