Solved

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

Posted on 2014-03-27
6
453 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
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

947 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

19 Experts available now in Live!

Get 1:1 Help Now