Actual URL

  • Thread starter Thread starter A.M
  • Start date Start date
A

A.M

Hi,

I underestand that if I use :

Response.Redirect("~main.aspx");

The request will be redirected to main.aspx in the root of application
folder which can be an IIS virtual directory.

How can I know where is the exact path of "~main.aspx" on web server. Is
there any helper function is asp.net do that for me ?

Thanks,
Allan
 
No, MapPath return the path on actual file system and is disfferent thing.

What I am looking for is having http path.
For example "~/main.aspx" can be "YourDomain/YourVirtualDirectory/main.aspx"
In above example main.aspx exists on /YourVirtualDirectory/

Allan


Server.MapPath("main.aspx") <-- will return an absolute path to main.aspx
 
Hi Allan,

I think the Control.ResolveUrl Method is want you want, it'll convert the
input url path(maybe relative or incomplete) to
the correct url path on the server. Also, since the asp.net page is the
derived class from Control, you can directly call
Page.ResolveUrl
For detailed description, please view the following referece:

#Control.ResolveUrl Method
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlCl
assResolveUrlTopic.asp?frame=true


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Hi Allan,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top