Solved

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

Posted on 2014-03-27
6
449 Views
Last Modified: 2014-05-28
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
Comment
Question by:feesu
6 Comments
 
LVL 5

Assisted Solution

by:indrajitmahajan
indrajitmahajan earned 100 total points
ID: 39958407
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
 
LVL 26

Assisted Solution

by:Alan Warren
Alan Warren earned 100 total points
ID: 39958581
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
 

Author Comment

by:feesu
ID: 39964738
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 6

Accepted Solution

by:
mwenenko earned 300 total points
ID: 40076128
Have you installed and enabled Forms Authentication module in IIS 7? Can you post a screenshot of Authentication types from IIS console?
0
 

Author Comment

by:feesu
ID: 40089368
Hi mwenenko,

Please see if the attached helps.

Thanks
snap.png
0
 

Author Comment

by:feesu
ID: 40095224
Ok, I think I've figured it out. Thanks.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now