.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Membership login not working

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net


I am developing a website in which giving login functionality through membership and asp.net login control.My membership login was working fine but now its not working.

I m checking authentication through HttpContext.Current.User.Identity.IsAuthenticated but it always return false.

And when checking through Membership.ValidateUser(Login1.UserName, Login1.Password) it gets authenticated..

why this is happening.........

plz help........

View Complete Post

More Related Resource Links

AspNet Membership Login Stoped Working !!!


Hello all

I have a web app that uses the Membership Provider to authenticate users.

Everything worked fine until today... when I tryed to log in it failed.

I looked in the database if something went wrong there and the user is deleted but everything looks fine there.

I tryed to recover the password using the user name and i got an error that the user is not recognized.

I tyed to recover the password (even though I am sure what the password is) but still no luck... (I get an error that hased passwords can not be decrypted)

I triyed it in local host and guess what ... still the same...

this is the provider section in my web config

    <membership defaultProvider="SqlMemberShipProvider">
        <remove name="SqlMemberShipProvider"/>
        <add name="SqlMemberShipProvider" 

Any i

Login control not working in IE7


I spent the last few weeks getting a client site up and running, but all the while I was doing all my testing with Firefox.

I tried seeing what it would look like in IE7, and everything is great.  Except that I cannot login with it.

 I do not know for the life of me why.

Any ideas?

 I am using VWD 2008 and i have a 3.5 web.


"Remember Me Next Time" under Login Control is not working

I am using VS 2005 and created a Login control. Login control provides "Remember Me Next Time" check box, I check this box but it does not remember next time. I have following entry in the web.config file <authentication mode="Forms"> <forms name=".MyCookies" loginUrl="login.aspx" protection="All" timeout="5000000" cookieless="UseCookies" slidingExpiration="true" path="\"></forms> </authentication> What am I missing? Thanks

Membership Login mechanices

Howdy,  I have a site where I am using asp.net membership login. I have multiple companies creating login accounts, to minimize name collision I would  like to append the company name on the end of the username during the login process. I can determine the company based on the url. I am able to authenticate the user in onauthenticate, but I am not sure how to actually login the account with the modified username properly.   Example: I use login JohnSmith I append JohnSmith@company1 behind the scenes. And I authenticate the user in the onauthenticate event using validate user with this modified name. However, I really haven't stopped the JohnSmith account from being used so none of the Profile stuff works. Any help is this ability located in on loggingin or onlogged in events?  

ASP.NET 5.0: Multiple logins and login types in default ASP.NET membership provider

What do you think about an ability of having multiple logins and login types to be attached to the same user? Let me explain this by showing how database schema can be re-factored to support this model:Remove [Password], [PasswordSalt] columns from [Users] database tableAdd [Logins] table with one-to-many relationship between [Users] and [Logins] tablesThis will allow one user to have multiple credentials attached to his or her account of different types such as Username&Password, Windows Live ID, Open ID from different providersYou will be able to restrict allowed login types and OpenID providers in web.config So.. do you think it is a good idea to add support of this model into ASP.NET 4.5/5.0 membership service?http://aspnet.codeplex.com/workitem/7149

membership provider with custom login form problem / question

Hi all, I am using the .net membership provider, and I can get past the membership.validate user ok and into my secure page.   The problem I have is that when I reach the secured page, I have a login status control which isn't changing from login to logout.   Below is my login code:If Membership.ValidateUser(txtUsername.Text, txtPassword.Text) Then Response.Redirect("/auth/Default.aspx") If chkRememberMe.Checked Then FormsAuthentication.SetAuthCookie(txtUsername.Text, True) Else FormsAuthentication.SetAuthCookie(txtUsername.Text, False) End If Else lblLoginStatus.Text = "Oops! Login not found!" End If    Thanks in advance.

Login controls not working in VS2008



I am creating a asp.net 3.5 app using VS2008 on a Vista Ultimate machine. I wanted to add the login features using the login controls. I was able to create users and roles without any problem using the web admin tool that comes with VS. But when I try to login using the same credentials I am always getting "Your login attempt was not successful. Please try again." error message. I am using MS Sqlserver 2008 as the backend. I am not using any .mdf or sqlexpress databases. I even deletd the App_Data folder. In sqlprofiler, I see the web admin tool is connecting, but when I try to login using the login control, it doesn't even show up on the sql profiler. I tried to launch VS 2008 as an admin, still no success. I tried to browse with IE or FireFox. The dev site is not hosted on IIS yet, and it is running on the dev server that comes with VS 2008. I have squandered nearly one week on this issue. Ironically I was able to to create a website last year with these same controls on VS2005 and Windows XP professional, and the site is running like a charm!

The following is the entry in my web.config file:

<membership defaultProvider="SqlMembershipProvider1"

Custom Login Page , with custom membership provider for sharepoint 2010


Dear All,

I am new to sharepoint, i am developing a custom application on sharepoint 2010. i need to create a custom login page in sharepoint 2010 with a custom membership provider which will authenticate against a 3rd party web service. 

Can anybody guide me with the steps i need to do for this. do i need to write a custom claims provider for this or is it enough if i write a custom authentication provider and use it for my login page which we do for asp.net.

i am confused about these. 

thanks in advanace 


.Net 3.5 Membership DB not working with .net 4.0?


Hey All

I am working on a new application that will feed off my application's DB that was written with .net 3.5 (really 2.0, since thats where the aspnet_regsql.exe lives)... I open up the application settings page on my old VS2008 application, and see all my 4000+ users, but if i link the membership to that database in VS2010 with asp .net 4.0, it shows 0. I have verified the connections, and i also noticed there is a net aspnet_regsql.exe in the 4.0 framework folder.

Is there any way to make the old membership work, or a way to migrate my users? If not, i would think this would cause a LOT of issues with many .net applications with many forms based users.  

Login controls and custom membership provider


I am working on implementing a custom membership provider that works against an existing schema in my database and have a few thoughts/question.

The login control will automatically call the ValidateUser method of the membership provider, so no matter how I implement the provider the only thing the login control cares about the bool value returned by this method.  What I am confused about is there could be numerous reasons why a login attempt failed; user is locked out, too many tries in a period of time, etc.  There is no way that I see to convey that to the control so it could display the proper message.  Other properties of the membership provider such as PasswordStrengthRegularExpression have absolutely no effect on the login control as well (out of the box), I would have hoped that it would automatically somehow translate into regular expression validators, but that doesn't seem to be the case.  So it seems that I need to initialize the login control properties with these settings out of the provider configuration if I want them to take on the control itself.

If the only thing that the Login control does out of the box (without manually handling events and doing the initialization as described above) is call the ValidateUser method on the membership provider, I see no way to convey back to the Login control why the validation

Membership.GetUser().UserName On Login Page



I have an Employee class in my App_Code folder.  On my login page I am trying to create an Employee using the asp.net username as a parameter in my Employee constructor.

 I have tried creating the employee in the page load event when it is a post back.  I have tried doing it in the Login1_LoggedIn event.  For some reason I cannot pull the username in either one of these places, but if I redirect after logging in and do the same thing on another page, it works.

How can I get it done on the login page?


  Dim em As Employee

        em = New Employee(CInt(Membership.GetUser().UserName))


Login not working in Internet Explorer


Hey guys, i have made a login page for my website....my website is working very fine in google chrome..

but when i use it on Internet Explorer, it is not getting beyond log in page. 

I guess the problem is it automatically encrypts the page , but then not able to fetch the data....


if used the following code on the login

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        sql3 = "Select * from login where username='" + TextBox6.Text + "' and password='" + TextBox7.Text + "'"
        If con.State = Data.ConnectionState.Open Then

Membership Provider - Login fails after change in database name


Hi Experts,

I am in the process of deploying an website developed in ASPNet 2.0 and using the login control and membership provider features. The site was deployed fine and was working perfectly till I changed the database name and user name to access the database. I changed the accordingly in the web.config to point to the new database. Everyting is working file except when the user tries to login into the website.

The error log says that login failed because it is trying to open the old database.

Any idea how I can solve the issue? Thanks for your help.



Roles.GetAllRoles() And Membership.GetAllUsers() Not Working.


Hello Forum,


I have been attempting to load my users and roles into a couple of listboxes but for some reason the listboxes are showing up empty.  What am I doing wrong?


<%@ Page Language="VB" MasterPageFile="~/PEPMasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script runat="server">

Dim rolesArray() As String
Dim users As MembershipUserCollection

    Public Sub Page_Load()

        Msg.Text = ""

        If Not IsPostBack Then
            ' Bind roles to ListBox.

            rolesArray = Roles.GetAllRoles()
            RolesListBox.DataSource = rolesArray

            ' Bind users to ListBox.

            users = Membership.GetAllUsers()
            UsersListBox.DataSource = users
        End If
    End Sub

Public Sub AddUser_OnClick(sender As Object, args As EventArgs)


Custom Login Page , with custom membership provider for sharepoint 2010


Dear All,

I am new to sharepoint, i am developing a custom application on sharepoint 2010. i need to create a custom login page in sharepoint 2010 with a custom membership provider which will authenticate against a 3rd party web service. 

Can anybody guide me with the steps i need to do for this. do i need to write a custom claims provider for this or is it enough if i write a custom authentication provider and use it for my login page which we do for asp.net.

i am confused about these. 

thanks in advanace 


Membership, login


mvc default project has account controller, view and model. there is a form in view page but this form has not got action. how can it understand which action will be call? there is two action ,called LogOn, in controller page 

public ActionResult LogOn()  ////this is first action
            return View();

public ActionResult LogOn() ////this is second action
            return View();

        public ActionResult LogOn(LogOnModel model, string returnUrl)
            if (ModelState.IsValid)
                if (MembershipService.ValidateUser(model.UserName, model.Password))

Login Control and ASP.Net Membership & Role


I am currently working in an ASP.Net application where i need to implement ASP.Net Membership and Roles. I have used Login controls in my pages. Also I am using a menu in the master page, which is getting data bindings from database. For data bindings I am using XMLDatasource and a transform file (.xslt file). I need to bind the data to the Menu based on the user roles.


My issue is that the generated Menu is not behaving consistently. Sometimes it will show the correct menu for a particular role and some times it will show previously loaded data.

Providing my code here:


private void LoadMenuItems() {

System.Security.Principal.IPrincipal User;

User = System.Web.HttpContext.Current.User; 

string appName = HttpContext.Current.Request.ApplicationPath;
string username = User.Identity.Name;

DataSet menuSet = new DataSet();  

xmlDataSource.Data = null;

menuSet = GetMenuDetails(appName, username);

menuSet.DataSetName = "Menus";

menuSet.Tables[0].TableName = "Menu"; 


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend