Solved

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

Posted on 2014-03-27
6
455 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 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