473,770 Members | 6,348 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_Beg inRequest
Sub. But as i use server.transfer in my web application i get always the old
URL even if
i use the property "HttpContext.Cu rrent.Request.C urrentExecution FilePath".

My global.asax

....
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As EventArgs)

Dim myCurrentURL As String =
HttpContext.Cur rent.Request.Cu rrentExecutionF ilePath
....

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.Cur rent.Request.Cu rrentExecutionF ilePath .... 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 1689
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.Redire ct)
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.Redire ct then you'll need to access
HttpContext.Cur rent.Request.Cu rrentExecutionF ilePath at the page level.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Fabrice" <em******@spa m-infonie.fr> wrote in message
news:eI******** ********@TK2MSF TNGP10.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_Beg inRequest
Sub. But as i use server.transfer in my web application i get always the
old URL even if
i use the property
"HttpContext.Cu rrent.Request.C urrentExecution FilePath".

My global.asax

...
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As EventArgs)

Dim myCurrentURL As String =
HttpContext.Cur rent.Request.Cu rrentExecutionF ilePath
...

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.Cur rent.Request.Cu rrentExecutionF ilePath ....
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.Redire ct)
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.Redire ct then you'll need to
access HttpContext.Cur rent.Request.Cu rrentExecutionF ilePath at the page
level.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Fabrice" <em******@spa m-infonie.fr> wrote in message
news:eI******** ********@TK2MSF TNGP10.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_Beg inRequest
Sub. But as i use server.transfer in my web application i get always the
old URL even if
i use the property
"HttpContext.Cu rrent.Request.C urrentExecution FilePath".

My global.asax

...
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)

Dim myCurrentURL As String =
HttpContext.Cur rent.Request.Cu rrentExecutionF ilePath
...

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.Cur rent.Request.Cu rrentExecutionF ilePath
.... 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
4614
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 Server.Transfer always throws the ThreadAbortException. MSDN acknowledges that this is a unque exception that will be automatically rethrown - i.e. it can't be swallowed. Does anyone know if there is extar code I can write (maybe something in the...
11
6045
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 falls into an infinite loop and later a StackOverflow Exception. I need to do this and not a Response.Redirect or a transfer with the bool in false. My problem is that this KB is saying that this problem should be solved with ServicePack 1 of...
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 was solved on Service Pack 1 of .NET 1.1 when it didn't. Could any one give me a hand on this? Just give it a try, create a new web project, put a button on webForm1.aspx and on the event handler put this code: Server.Transfer("webForm1.aspx ",...
8
3901
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 need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5312
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
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 we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.