Form authentication works on dev server but not on

2020-05-06 12:31发布

问题:

We have a similar problem. We have a web application running under default appdomain. It was working fine until a week before...Suddenly it has encountered a problem. Below message is taken from event logs.

Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied has expired. 

Application uses FormsAuthentication and gets the roles from aspnetdb.. After the error, when user logins to the page, it does not redirects to the default.aspx. Again login.aspx comes up. On the other hand application works fine on development server(localhost), but not on www(IIS 6.0).

Does any one has an idea?

Thanks,

İlknur

回答1:

It looks that when Application Pool your app is running on is in Integrated Managed Pipeline Mode, which is default under IIS 7, you will need to add

<system.webServer>
  <modules>
      <add  name="FormsAuthenticationModule"  type="System.Web.Security.FormsAuthenticationModule" />

To configuration.

Please refer to [Performing Forms-Based Authentication and URL Authentication on Static Files with IIS 7] section from this article

Initially I added aforementioned section to web.config by hand, but IIS complained with runtime error, so I ended up using MMC panel for IIS (inetmgr) to add it via GUI. Application's config file wasn't modified, but feature started to work, so I'm not sure which configuration file GUI tool applied the change to.