How do you set the startup page for debugging in an ASP.NET MVC application?

后端 未结 6 1926
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 21:47

How do you start debugging the application at the application root? For example: http://localhost:49742/

I\'m always getting a page which doesn\'t e

6条回答
  •  囚心锁ツ
    2020-11-29 22:21

    Revisiting this page and I have more information to share with others.

    Debugging environment (using Visual Studio)

    1a) Stephen Walter's link to set the startup page on MVC using the project properties is only applicable when you are debugging your MVC application.

    1b) Right mouse click on the .aspx page in Solution Explorer and select the "Set As Start Page" behaves the same.

    Note: in both the above cases, the startup page setting is only recognised by your Visual Studio Development Server. It is not recognised by your deployed server.

    Deployed environment

    2a) To set the startup page, assuming that you have not change any of the default routings, change the content of /Views/Home/Index.aspx to do a "Server.Transfer" or a "Response.Redirect" to your desired page.

    2b) Change your default routing in your global.asax.cs to your desired page.

    Are there any other options that the readers are aware of? Which of the above (including your own option) would be your preferred solution (and please share with us why)?

提交回复
热议问题