Mediator
Mediator

Reputation: 15378

How do i remove root folder name from URL?

I create new blank solution. Add exist web site. Structure: Solution E:...\projectname Folders: bin app_code app_data ...

http://localhost:49062/projectname/

but I need only http://localhost:49062.

How to do this?

Upvotes: 4

Views: 1512

Answers (2)

Israel Aris
Israel Aris

Reputation: 1

Simply, Use .Split(char) method. you can do something like that:

string web = "http://localhost:49062/projectname/";
string[] webParts = web.Split('/');

and all the webParts[] cell will be like that:
webParts[0] = http://
webParts[1] = localhost:49062
webParts[2] = projectname

` I might be mistaken in the cell parts, but it's sure works. test it.

Upvotes: -1

Curtis
Curtis

Reputation: 103388

In Visual Studio 2010:

  • In Solution Explorer, right-click on folder path (should be right at the top)
  • Click on "Properties Window"
  • In the Virtual Path it will state "/projectname"
  • Clear the field

Try "View In Browser" again. This should now have removed the root folder name from the URL

Upvotes: 8

Related Questions