This project is read-only.

Virtual directory name with domain name on shared hosted solution

Topics: ASP.NET 2.0
Sep 28, 2010 at 12:59 PM

i have seen this posted on a couple different forums but have NOT found a resolution to this issue.

i have uploaded my ASP .NET web application on GoDaddy's Shared Hosting. Im having an issue with the Request.ApplicationPath returning the folder name with the domain name. For example, if my domain is "", Request.ApplicationPath returns "" since the web application has been installed in the "mywebsite" virtual directory.

I AM in fact able to access all pages within the website with "". However, when I use the tilde operator to access a page ("~/samplepage.aspx"), it adds the folder name after the domain name and resolves to this url - "" (due to Request.ApplicationPath returning the foldername with the domain name)

I'd like to find a way such that references to the tilde operator resolve to just my domain name i.e. "~/samplepage.aspx" should resolve to ""

If this was an issue in only a couple of places, we would have resolved this by writing the entire path to the page, however, this happens in several places including the menucontrol, sitemapcontrol, all references to response.redirect(), etc.

Please help us find a robust long term solution to this issue.

Sep 28, 2010 at 8:31 PM

I have this same problem.  After talking w/ my account rep, she sent me this info.  I haven't tried it yet, but she assures me this is the solution.

Windows hosting accounts using IIS7 support the Microsoft® URL Rewrite Module, which rewrites complicated URLs into more user-friendly URLs based on rules specified by the webmaster in the account's web.config file.

NOTE: The Microsoft URL Rewrite Module is supported on Windows hosting plans running IIS7. To check which version you have, log in to your Account Manager, click Web Hosting in the Products section, and then click Launch next to the account you want to use. Your IIS Version displays in the Account Summary section.

For example, the Microsoft URL Rewrite Module could rewrite


For more information, see Microsoft’s® URL Rewrite Module documentation.

Apr 21, 2014 at 8:45 PM
I ran into same issue, there were many posts that suggested below rewrite rule in web.config under system.webserver but this did not work for me
    <rule name="Remove Virtual Directory">
      <match url=".*" />
      <action type="Rewrite" url="{R:0}" />