Reputation: 17898
So, all my urls somehow do not work as I want.
e.g my website url is http://IPAddress/MyWebsite.
'MyWebsite' is my virtual path, and somehow all linkage are messed up since:
<a href="~/Default.aspx"> Redirects to http://IPAddress/Default.aspx
or-
Response.Redirect("~/Default.aspx") Redirects to http://IPAddress/Default.aspx
or-
<link rel="stylesheet" type="text/css" href="../static/css/mysupercss.css" /> Links to http://IPAddress/static/css/mysuper.css
Instead of redirecting to http://IPAddress/MyWebsite/[THEN THE URL]
anyone knows where my problem is?
Any help is greatly appreciated.
Upvotes: 0
Views: 1784
Reputation: 887
I was having this problem, but I noticed the problem links were only those that were for other pages on the site. Same page anchors with a hash (<a href=#blah>
) we not causing problems. After some digging around I noticed my affected links to my glossary page were missing the ~/
prefix.
Changing
<a href="glossary.html#Term_A">Vehicle Configuration</a>
to
<a href="~/glossary.html#Term_A">Vehicle Configuration</a>
got everything working in production again. Without the tilde slash prefix everything worked in development, but once in production with the virtual path in place I was having issues.
Upvotes: 0
Reputation: 31248
You need to change the virtual path into an application. In IIS manager, right-click on the virtual path and select "Convert to application".
Upvotes: 2