ProfK
ProfK

Reputation: 51064

Remove site name from ASP.NET built in web server URL's

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 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?

Upvotes: 1

Views: 924

Answers (3)

rtpHarry
rtpHarry

Reputation: 13125

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:

The steps from the article are:

  1. In the Solution Explorer window you select your Project node
  2. 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.

Upvotes: 4

ggonsalv
ggonsalv

Reputation: 1262

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

Upvotes: 0

Paddy
Paddy

Reputation: 33857

Can you change your hard coding?

e.g. Response.Redirect("~/Index.aspx") 

will build a path relative to your root.

Upvotes: 1

Related Questions