简体   繁体   中英

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. Everything has worked great etc. Until I put it in IIS. I have a very strange issue. I can only go to page.com/ which is the HOME controller and Index view ONLY ONCE. 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. But on some other controller it does look good like page.com/Information/Shop

Anybody know what might be the home index issue?

Web.config looks like this

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?

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.

It is likely that the IIS site you deployed to has the webroot folder for your site set to require authentication. 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. 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. The settings can typically changed in your web.config file. Here is a link to MSDN describing the authentication section.

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

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