Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: URL and Redu=irect


Message #1 by "Kan Yu Ting" <yu-ting.kan@p...> on Thu, 20 Jun 2002 04:37:31
Dear,

I want to get the current URL and the base URL. How can I do?
What is the difference between Response.Redirect and Server.Transfer?

Thanks
Kan
Message #2 by "Alex Homer" <alex@s...> on Thu, 20 Jun 2002 11:59:54 +0100
Try writing some of these values from the Request object properties to the
Trace object, or directly into the page, to get a feel for what they
contain:

[taken from SDK page System.Web.HttpRequest properties page]
Request.ApplicationPath: Gets the ASP.NET application's virtual application
root path on the server.
Request.CurrentExecutionFilePath: Gets the virtual path of the current
request.
Request.FilePath Gets the virtual path of the current request.
Request.Path: Gets the virtual path of the current request.
Request.PathInfo: Gets additional path information for a resource with a URL
extension.
Request.PhysicalApplicationPath: Gets the physical file system path of the
currently executing server application's root directory.
Request.PhysicalPath: Gets the physical file system path corresponding to
the requested URL.
Request.RawUrl: Gets the raw URL of the current request.
Request.Url: Gets Information about the URL of the current request.

Or take a look at the value available in the Request.ServerVariables
collection also listed on this SDK page.

Using Server.Transfer causes ASPX to switch execution to the page specified,
but the user doesn't see this and their browser still shows the original
URL.
Using Response.Redirect tells their browser to load the page you specify,
and this appears in their browser address bar.







Message #3 by "Kan Yu Ting" <yu-ting.kan@p...> on Thu, 20 Jun 2002 18:12:35
Thanks Alex. That's what I am looking for.

Kan :)

> Try writing some of these values from the Request object properties to 
the
Trace object, or directly into the page, to get a feel for what they
contain:

[taken from SDK page System.Web.HttpRequest properties page]
Request.ApplicationPath: Gets the ASP.NET application's virtual application
root path on the server.
Request.CurrentExecutionFilePath: Gets the virtual path of the current
request.
Request.FilePath Gets the virtual path of the current request.
Request.Path: Gets the virtual path of the current request.
Request.PathInfo: Gets additional path information for a resource with a 
URL
extension.
Request.PhysicalApplicationPath: Gets the physical file system path of the
currently executing server application's root directory.
Request.PhysicalPath: Gets the physical file system path corresponding to
the requested URL.
Request.RawUrl: Gets the raw URL of the current request.
Request.Url: Gets Information about the URL of the current request.

Or take a look at the value available in the Request.ServerVariables
collection also listed on this SDK page.

Using Server.Transfer causes ASPX to switch execution to the page 
specified,
but the user doesn't see this and their browser still shows the original
URL.
Using Response.Redirect tells their browser to load the page you specify,
and this appears in their browser address bar.








  Return to Index