Click here to Skip to main content
15,867,835 members

Can not login using ASP.NET Login Control

Jyoti Choudhury asked:

Open original thread
I am new in ASP.NET and I am facing problem using Login Control that is built-in with ASP.NET.

I want to build an web application that has login control. I used ASP.NET Configuration wizard to setup the login authentication config. I have created 2 users and 2 roles allready, but the problem is, I can not login using the username/password of the user allready created in the database.

I have following code written in Login_Authenticate event:

C#
if (User.Identity.IsAuthenticated == false)
                Response.Redirect("frmUserLogin.aspx");
            else if (Roles.IsUserInRole("Member"))
            {
                Response.Redirect("~/Protected/frmMemberHome.aspx");
            }

First if condition refers to the situation when authentication fails else I have checked for the roles in which my user is included. Based on their roles, I have redirected them to different pages. That is all my plan to evaluate.

Problem is each time I am trying to login using correct username/password for existing user, it fails and shows error messages for Authentication Failure. I don't have any idea. I dont know, If I am doing wrong or not! Please help me out!
Tags: C# (C# 4.0), ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900