How to remove root folder name from URL?

I am creating a new blank solution. Add an existing website. Composition: Solution E: ... \ project_name Folders: App_Code bunker app_data ...

http: // localhost: 49062 / projectname /

but I need http: // localhost: 49062 .

How to do it?

+4
source share
2 answers

In Visual Studio 2010:

  • In Solution Explorer, right-click the path to the folder (should be in the upper right)
  • Click "Properties Window"
  • Virtual Path will say "/ projectname"
  • Clear field

Try browsing again in your browser. Now this should remove the root folder name from the URL

+8
source

Just use the .Split (char) method. you can do something like this:

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

and all webParts [] cells will be like this:
webParts[0] = http://
webParts[1] = localhost:49062
webParts[2] = projectname

Κ»I may be wrong in parts of the cell, but it works. test it.

-1
source

Source: https://habr.com/ru/post/1403641/


All Articles