Detect the virtual directory name of an applicatio

MrBadDay

New Member
Hi, <BR>Please help. In my application, I need to programmatically detect the name of the virtual directory that my application is run on. The problem is this must also work when the application is deployed as a website (no virtual directory involved).<BR><BR>For example, if my application is located at<BR>http://www.server.com/virtual/default.aspx<BR>then the detecting function should return "/virtual/"<BR><BR>But if the application is deployed at<BR>http://www.server.com/default.aspx (ie, no virtual directory)<BR>then the function should return "/"<BR><BR>Is there an easy way to do this?<BR><BR>Thanks for your help.<BR><BR>
 
Top