I'm debugging a site that is deployed to the site root on the production server, but in my local copy, under the built-in, debugging web server, the URL's include the 'site name'. E.g. my local site is 'PVLive', so all URL's are 'localhost:nnnnn/PVLive/mmmm.aspx'. Certain URL's are hard coded in the site's pages to use paths relative开发者_如何学JAVA to the root, e.g. I get errors when code tries to redirect to 'localhost:nnnnn/Index.aspx'.
Can I do something to keep the 'PVLive' site name out of the URL's?
Yes you can change the url that your site is run on in cassini (the built in dev server).
I have written an article about this before which you can read here:
- An easy way to keep your dev and live server urls in sync
The steps from the article are:
- In the Solution Explorer window you select your Project node
- In the Properties window (press F4 if you can't see it) you change the "Virtual path" attribute from /ProjectName to /
But you should read the article if you like screenshots and some background info.
Can you change your hard coding?
e.g. Response.Redirect("~/Index.aspx")
will build a path relative to your root.
The best way is to test it as the root on the dev machine. In my opinion, the closer you dev environment, mimics the production environment less post roll-out issues you have with broken links.
If you dev machine is Windows server version that you can host it as root on a different
port.
If you machine is Windows Xp you can use iisadmin.net to host IIS on different ports similiar to Windows Server.
http://iisadmin.codeplex.com/
Remember this is the non-answer so negative votes would be please avoided
精彩评论