Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

Find out the virtual directory path

Is there a way for me to find out if my application is running inside of a virtual directory?

For example:

http://bookstore.slcc.edu/purchase/booksearch.aspx


/purchase

is a virtual directory.


When booksearch.aspx is loaded....in the Page Load can I find-out about "/purchase" virtual directory?


My problem is that when I redirect instead of going to:

http://bookstore.slcc.edu/purchase/somenewpage.aspx

I end up going to:

http://bookstore.slcc.edu/somenewpage.aspx

ASKER CERTIFIED SOLUTION
Avatar of Praveen Venu
Praveen Venu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
redirect like Response.Redrect("MyPage.aspx")

Dont use Response.Redirect("/MyPage.aspx")
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tom Knowlton

ASKER

Request.ApplicationPath seemed to solve the problem.

I had to add logic to check the length of the path.  If there is no virtual directory, ApplicationPath is "/".  If a virtual directory is in use, it will equal "/<virtual path alias>"