简体   繁体   English

asp mvc 3 主页索引页面仅加载一次

[英]asp mvc 3 home index page only loads ONCE

I created an asp mvc 3 project using the default layout that comes with the non-empty application.我使用非空应用程序附带的默认布局创建了一个 asp mvc 3 项目。 Everything has worked great etc. Until I put it in IIS.一切都很好。直到我把它放在 IIS 中。 I have a very strange issue.我有一个非常奇怪的问题。 I can only go to page.com/ which is the HOME controller and Index view ONLY ONCE.我只能 go 到 page.com/ 这是 HOME controller 和索引视图只有一次。 When i first load the page i see it.当我第一次加载页面时,我看到了它。 But then when i click the home button it takes me to the account log on, and the url is messed up it looks like page.com/account/logon=?and a bunch of other information.但是当我单击主页按钮时,它会将我带到帐户登录,并且 url 被搞砸了,它看起来像 page.com/account/logon=? 和一堆其他信息。 But on some other controller it does look good like page.com/Information/Shop但是在其他一些 controller 上看起来确实不错,例如 page.com/Information/Shop

Anybody know what might be the home index issue?有人知道房屋指数可能是什么问题吗?

Web.config looks like this Web.config 看起来像这样

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

Are you using Named Pipes?你在使用命名管道吗? .Net 4.0? .Net 4.0?

it could be that your home link is pointing to something different (whether thats www. or lack there of, or localhost/home rather than localhost) and this is causing the confusion in routing.可能是您的主页链接指向不同的东西(无论是 www. 还是没有,或者 localhost/home 而不是 localhost),这会导致路由混乱。

It is likely that the IIS site you deployed to has the webroot folder for your site set to require authentication.您部署到的 IIS 站点可能将站点的 webroot 文件夹设置为需要身份验证。 Thus, when you attempt to access the pages it requests you log in. Once logged in the users information should be maintained in the SessionState so you would not be required to login again during that session.因此,当您尝试访问它要求您登录的页面时。一旦登录,用户信息应该保存在 SessionState 中,这样您就不需要在 session 期间再次登录。 Of course, once the session is ended (due to timeout or certain navigation events) the users informaiton is lost and you would need to log in again.当然,一旦 session 结束(由于超时或某些导航事件),用户信息就会丢失,您需要重新登录。 The settings can typically changed in your web.config file.通常可以在 web.config 文件中更改设置。 Here is a link to MSDN describing the authentication section.这是描述身份验证部分的 MSDN 链接。

http://msdn.microsoft.com/en-us/library/532aee0e.aspx http://msdn.microsoft.com/en-us/library/532aee0e.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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