473,805 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can login with Login Control

ad
I used login Controls of VS2005 to develop Web application.
My program will check password and user ID in login.aspx. If the password
is wrong, my program will display an "password is wrong" message to user.
If the ID and password are correct, my program wiill transfer to home.aspx
After my program deployment to server, when user login with correct ID and
wrong pw, it display "password is wrong" message.
But if the ID and password are both correct, it stay in login.aspx with no
"password is wrong" message, but not transfer to home.aspx.

It may be something wrong ! How can I do?
Aug 28 '06 #1
9 2405
hi ad,
how can we know what's wrong when you didn't post any code?!
please post your web.config and all the code-behind for your login page.

tim
Aug 28 '06 #2
ad
Thanks, below is my web.config and custum MembershipProvi der
Please help me.

<?xml version="1.0"?>
<configuratio n xmlns="http://schemas.microso ft.com/.NetConfigurati on/v2.0">
<appSettings>
</appSettings>
<connectionStri ngs>
............... .......
</connectionStrin gs>
<system.web>
<httpRuntime maxRequestLengt h="2097151"/>
<membership defaultProvider ="MyMembershipP rovider">
<providers>
<add name="MyMembers hipProvider" type="MyMembers hipProvider"
minRequiredPass wordLength="7"/>
</providers>
</membership>
<httpHandlers >
....
</httpHandlers>
<siteMap>
<providers>
......
</providers>
</siteMap>
<authenticati on mode="Forms">
<forms name="HealthCoo kie" loginUrl="Login .aspx" defaultUrl="~/Home.aspx"
protection="Val idation">
</forms>
</authentication>
<authorizatio n>
<deny users="?"/>
</authorization>
<customErrors mode="RemoteOnl y"
defaultRedirect ="~/ErrorPage/GenericErrorPag e.aspx">
.......
</customErrors>
<pages maintainScrollP ositionOnPostBa ck="true"
masterPageFile= "~/MasterPage.mast er"/>
<sessionState mode="InProc"/>
<compilation debug="true">
<buildProviders >
.......
</buildProviders>
<assemblies>
......
</system.web>
</configuration>
public class MyMembershipPro vider : MembershipProvi der
{
private FormsAuthentica tionUserCollect ion _users = null;
private FormsAuthPasswo rdFormat _passwordFormat ;
//private int _MinRequiredNon AlphanumericCha racters = 0;
private int _MinRequiredPas swordLength = 4;
//private int _MaxInvalidPass wordAttempts = 5;
//private int _PasswordAttemp tWindow = 5;
#region Not Implemented Members
public override string ApplicationName
{
............... ..............

public override MembershipUser GetUser(string username, bool
userIsOnline)
{
DateTime myDate = DateTime.Today;
MembershipUser user = new MembershipUser(
Name, // Provider name
username, // Username
null, // providerUserKey
"aa@wfs.tan.edu .tw", // Email
String.Empty, // passwordQuestio n
"Comment", // Comment
true, // isApproved
false, // isLockedOut
DateTime.Now, // creationDate
DateTime.Now, // lastLoginDate
DateTime.Now, // lastActivityDat e
DateTime.Now, // lastPasswordCha ngedDate
new DateTime(1980, 1, 1) // lastLockoutDate
);
return user;

}
public override bool ChangePassword( string username, string
oldPassword, string newPassword)
{
............... ............... ...............
}
public override void Initialize(stri ng name,
System.Collecti ons.Specialized .NameValueColle ction config)
{
base.Initialize (name, config);
_passwordFormat = getPasswordForm at();
string sMin=config["minRequiredPas swordLength"].ToString();
sMin = WillNs.Util.Get Default(sMin, "4");
_MinRequiredPas swordLength = int.Parse(sMin) ;
}

public override bool ValidateUser(st ring username, string password)
{
bool Authenticated = false;
Authenticated = DMHealth.CheckP W(username, password);
if (Authenticated)
{
//HttpContext.Cur rent.Session.Ab andon();
new AuthenticationS uccessEvent(use rname, this).Raise();
return true;
}
else
{
new AuthenticationF ailureEvent(use rname, this).Raise();
return false;
}
}

protected FormsAuthentica tionUserCollect ion getUsers()
{
if (_users == null)
{
AuthenticationS ection section = getAuthenticati onSection();
FormsAuthentica tionCredentials creds =
section.Forms.C redentials;
_users = section.Forms.C redentials.User s;
}

return _users;
}

protected AuthenticationS ection getAuthenticati onSection()
{
Configuration config =
WebConfiguratio nManager.OpenWe bConfiguration( "~");
return
(Authentication Section)config. GetSection("sys tem.web/authentication" );
}

protected FormsAuthPasswo rdFormat getPasswordForm at()
{
return
getAuthenticati onSection().For ms.Credentials. PasswordFormat;
}
protected MembershipSecti on getMembershipSe ction()
{
Configuration config =
WebConfiguratio nManager.OpenWe bConfiguration( "~");
return
(MembershipSect ion)config.GetS ection("system. web/Membership");
}
}

"Tim_Mac" <ti********@com munity.nospam级 糶秎ン穝籇:uP **************@ TK2MSFTNGP03.ph x.gbl...
hi ad,
how can we know what's wrong when you didn't post any code?!
please post your web.config and all the code-behind for your login page.

tim

Aug 28 '06 #3
hi Ad,
i notice you have ~/home.aspx as your defaultUrl.
how is your web site deployed in IIS. as a web site? virtual directory?
or just in a folder?
the reason i ask is because the ~ syntax refers to the root of the web
application. if you have it deployed inside a folder without creating an
application in IIS, the ~ url you use would refer to the wrong page and
possibly a 404.

tim
Aug 29 '06 #4
ad
Thanks,
i deployed my project to as an application of IIS.
But maybe the ~/ is not need.
Have there any reason cause repeating login?


"Tim_Mac" <ti********@com munity.nospam级 糶秎ン穝籇:uz **************@ TK2MSFTNGP02.ph x.gbl...
hi Ad,
i notice you have ~/home.aspx as your defaultUrl.
how is your web site deployed in IIS. as a web site? virtual directory?
or just in a folder?
the reason i ask is because the ~ syntax refers to the root of the web
application. if you have it deployed inside a folder without creating an
application in IIS, the ~ url you use would refer to the wrong page and
possibly a 404.

tim

Aug 29 '06 #5
hi Ad,
sorry i'm not sure what you mean by repeating login..
tim
Aug 29 '06 #6
ad
I have remove the ~\ form the defaultUrl, but the user still repeating
login.
That is the login page appear again after the user login sucessfully, the
web application dose not direct to defaultUrl
"Tim_Mac" <ti********@com munity.nospam级 糶秎ン穝籇:uz **************@ TK2MSFTNGP05.ph x.gbl...
hi Ad,
sorry i'm not sure what you mean by repeating login..
tim

Aug 30 '06 #7
hi ad ,
you could try adding an event handler for the OnLoggedIn event of your Login
control.
then you can use Response.Redire ct to go wherever.

hope this helps
tim
"ad" <fl****@wfes.tc c.edu.twwrote in message
news:OX******** ******@TK2MSFTN GP04.phx.gbl...
>I have remove the ~\ form the defaultUrl, but the user still repeating
login.
That is the login page appear again after the user login sucessfully, the
web application dose not direct to defaultUrl
"Tim_Mac" <ti********@com munity.nospam>
级糶秎ン穝籇: uz************* *@TK2MSFTNGP05. phx.gbl...
>hi Ad,
sorry i'm not sure what you mean by repeating login..
tim


Aug 30 '06 #8
ad
Hi, Tim
Today I find a regularity on the problem pc.
If I use http://health/HealthWeb (where health is computer name, HealthWeb
is application name), the repeating login occur, but if I use
http://127.0.0.1/HealthWeb or http://192.168.0.12/HealthWeb, it run ok.
But if I call http://health/HealthWeb from another machine, it run ok.

It's really something strange!

Have some advice?
"Tim_Mac" <ti********@com munity.nospam级 糶秎ン穝籇:eg **************@ TK2MSFTNGP03.ph x.gbl...
hi ad ,
you could try adding an event handler for the OnLoggedIn event of your
Login control.
then you can use Response.Redire ct to go wherever.

hope this helps
tim
"ad" <fl****@wfes.tc c.edu.twwrote in message
news:OX******** ******@TK2MSFTN GP04.phx.gbl...
>>I have remove the ~\ form the defaultUrl, but the user still repeating
login.
That is the login page appear again after the user login sucessfully, the
web application dose not direct to defaultUrl
"Tim_Mac" <ti********@com munity.nospam级 糶秎ン穝籇:uz **************@ TK2MSFTNGP05.ph x.gbl...
>>hi Ad,
sorry i'm not sure what you mean by repeating login..
tim



Aug 31 '06 #9
hi,
you could try resetting the browser settings on that PC. it could be caused
by a different security zone for the 'health' web site. i can't imagine
exactly what would prevent the page loading, but perhaps cookies are
disabled or something.

all i can suggest is my previous post to manually redirect the user to
whatever page you want them to, if it is still causing problems.

good luck
tim

"ad" <fl****@wfes.tc c.edu.twwrote in message
news:uS******** ******@TK2MSFTN GP05.phx.gbl...
Hi, Tim
Today I find a regularity on the problem pc.
If I use http://health/HealthWeb (where health is computer name,
HealthWeb is application name), the repeating login occur, but if I use
http://127.0.0.1/HealthWeb or http://192.168.0.12/HealthWeb, it run ok.
But if I call http://health/HealthWeb from another machine, it run ok.

It's really something strange!

Have some advice?
"Tim_Mac" <ti********@com munity.nospam>
级糶秎ン穝籇: eg************* *@TK2MSFTNGP03. phx.gbl...
>hi ad ,
you could try adding an event handler for the OnLoggedIn event of your
Login control.
then you can use Response.Redire ct to go wherever.

hope this helps
tim
"ad" <fl****@wfes.tc c.edu.twwrote in message
news:OX******* *******@TK2MSFT NGP04.phx.gbl.. .
>>>I have remove the ~\ form the defaultUrl, but the user still repeating
login.
That is the login page appear again after the user login sucessfully,
the web application dose not direct to defaultUrl
"Tim_Mac" <ti********@com munity.nospam>
级糶秎ン穝 D:uz*********** ***@TK2MSFTNGP0 5.phx.gbl...
hi Ad,
sorry i'm not sure what you mean by repeating login..
tim



Aug 31 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2889
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
0
1298
by: Steve Commisso | last post by:
I'm trying to create a forked login where users of certain roles will be redirected to specific pages. The easy way to do this would be to do the redirecting in the Page_Load() of the default page after login, but I'd like to skip this step and just have the Login control go ahead and do it. So my plan is this: override the OnLoggedIn() method of the Login control with my own custom method that changes the DestinationPageUrl property...
14
2636
by: clintonG | last post by:
This is an appeal for peer support sent to Microsoft as will be noted in closing. The Login control does not include a Cancel button. The only option is to convert the Login control to a template which is not such a bad thing in itself but it means all other controls in the application must also be converted to templates to maintain a consistent UI. So much for writing 70% less code when foolish morons release a control with no cancel...
1
4540
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page, separate DB tables, etc). For one of these user types, the current application has an additional input field required for login鈥 they have a username, password, and another 鈥渓ocation code鈥 field. Please don鈥檛 make me explain or justify this鈥...
1
6988
by: Jeff Lynch | last post by:
I'd like to add the following attributes to the Login control's Login Button to create a CSS rollover effect. How can I access the control's login button from the page's code-behind? LoginButton.Attributes.Add("onmouseover", "this.className = 'buttonsmallover'"); LoginButton.Attributes.Add("onmouseout", "this.className = 'buttonsmall'"); -- Jeff Lynch
3
5793
by: ilockett | last post by:
The background: I have a web app with a simple master page that contains just one content placeholder. I have created a web form that then uses this master page. Within the content placeholder, I have placed a Login control (Login1) and a ValidationSummary control. I have set the ValidationSummary's ValidationGroup property equal to "Login1".
5
1924
by: Afshar | last post by:
Hi everybody there, I have a special Login page that wants users to enter 3 passwords rather than a single password. But can't do it with Login control. I tried following scenarios: 1. Put an Login in the page and set its Visible = False instead put my own username and 3 password on the form. Then I checked 2nd and 3rd password seperately and passed username and password to Login control via its Username and Password properties but...
2
4517
by: IdleBrain | last post by:
Hello All: I used a Login control to authenticate a user to login. The problem is that when I login with good username & password, the login view would say that the login was successful. But for some reason the login control does not redirect the control to DestinationPageUrl. Even when I hardcoded to redirect to another page, it still remains in the same page on successful login.
6
3365
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in the past in other places, and while the help was much appreciated, it seemed everyone just wanted to 'theoretically' explain how to do it, but when I tried to do it myself, I couldn't login. I want to simply pass the email address and password to...
6
8081
by: dan | last post by:
Hi, Could someone please let me know how to center a Login control on a page? Can I use CSS to do that? Thanks, Dan
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we抣l explore What is ONU, What Is Router, ONU & Router抯 main usage, and What is the difference between ONU and Router. Let抯 take a closer look ! Part I. Meaning of...
0
10607
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project梡lanning, coding, testing, and deployment梬ithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.