简体   繁体   中英

Start page without filename and extension in the URL

I am setting up a blank project in Visual Studio 2012 and have set my index.html as the start page. The problem I am having is that the URL now says "localhost:64237/app/index.html" as it is including the path to the index page.

I want to be able to type in "localhost:64237" and have it still access the index page, without showing me the rest of the path or the filename/extension in the URL.

Right-click the project and go to properties. Select "web" on the left-hand side. Under the "servers" section, you should be able to set it up with out "app". Once that's done, it should work like you want. If not, look into IIS and Virtual Directories.

You can use routing.

By using routing you can change this:

http://www.mywebsite.com/Product/ProductDetails.aspx?id=1
http://www.mywebsite.com/ProductProductDetails.aspx?name=Apple

into this:

http://www.mywebsite.com/Product/1
http://www.mywebsite.com/Product/Apple

or this:

http://www.mywebsite.com/Apple

Find more info in google about ASP.NET Routing.

good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM