Virtual directory problem in IIS for asp.net web application
My asp.net web application works fine locally and when I deploy it as the default web site on my test server. So for example, when I type http:// 10.10.10.100 it works fine.
I created a virtual directory called "Test" under my "Default Web Site".
When I type http://10.10.10.100/Test it loads correctly to my log-in page, howev开发者_StackOverflow中文版er when I log-in and click on a link it goes back to my log-in page and the url goes back referencing http://10.10.10.100 instead of http://10.10.10.100/Test/Default.aspx, for example.
My goal here is to run my application from the virtual directory and not as the default, but I don't want to change my code to a hard coded path since then it won't work anywhere else.
Any workarounds for this?
You have left a few unanswered questions, but some things to check:
- Which links are you using? In other words, are they plain HTML links (<a href=""> links), ASP.NET links (<asp:HyperLink>), LinkButtons (<asp:LinkButton>), etc.?
- How are you specifying the URL in those links? ASP.NET has a "shortcut" for root directory of the website if you use the tilde (~) character. So, to link to a page on your site called "MyPage.aspx", you might use "~/MyPage.aspx".
精彩评论