• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

ASP.NET 3.5 | IIS7 | Forms Authentication Does Not Work

Hello,

I have uploaded my asp.net 3.5 on my new webserver that runs iis7.

The website works fine, but when I try to log in to my sign in page (which uses forms authentication to save users credentials in a cookie), it does not authenticate the user.

It works fine on my local laptop so it seems that there is an option that I need to enable on the iis7.

Any help?
0
feesu
Asked:
feesu
3 Solutions
 
indrajitmahajanCommented:
hi..

If you want to enable authentication on your website for your users you can even leave the anonymous user and windows authentication enabled, so IIS will accept all the request coming to the webserver. You can then use form authentication (implemented with the SignIn method in the login page) to grant your visitors access to only certain parts of the website using the asp.net membership.

For more details:
http://support.microsoft.com/kb/301240
0
 
Alan WarrenCommented:
Hi feesu,

I suspect that the applicationID in the table/s aspnet_Membership and aspnet_Users is different on the live site than on your local machine, possibly because the ApplicationName is different. Check the SQL table aspnet_Applications, before and after you create a new user on the live site, you will probably find you have more than one application, one (your local app) and one (your live site), Asp .Net Membership supports multiple applications.
Scott Gu's blog "You should ALWAYS customize the Membership provider and specify an applicationName"...
    <membership defaultProvider="CustomizedProvider" userIsOnlineTimeWindow="20">
    <!-- passwordFormat="Hashed" note hashed passwords cannot be retrieved-->
      <providers>
        <clear/>
        <add connectionStringName="cnMyConnection" enablePasswordRetrieval="true" passwordFormat="Encrypted" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" maxInvalidPasswordAttempts="32000" passwordAttemptWindow="10" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="1" passwordStrengthRegularExpression="" applicationName="MySiteName" name="CustomizedProvider" type="System.Web.Security.SqlMembershipProvider"/>
      </providers>
    </membership>

Open in new window

I think you will find that if you sign up a new member on the live site, things will work as expected, but it won't work for members you created on your local machine, because the applicationID and possibly the ApplicationName differ.

Update aspnet_Membership set ApplicationID='theapplicationoftheuseryoucreatedonthelivesite'  
-- same for the other membership tables that require  appilication id

Open in new window


Respectfully yours,
Alan
0
 
feesuAuthor Commented:
Experts,

Thank you for your feedback.

My problem is not with code. My code has been running perfectly for years. However, this is the first time I upload my website to an IIS7 web server. That's the reason probably, and I am sure it is a certain setting in the IIS itself.

Any recommendation on that?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
mwenenkoCommented:
Have you installed and enabled Forms Authentication module in IIS 7? Can you post a screenshot of Authentication types from IIS console?
0
 
feesuAuthor Commented:
Hi mwenenko,

Please see if the attached helps.

Thanks
snap.png
0
 
feesuAuthor Commented:
Ok, I think I've figured it out. Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now