473,395 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

.NET 2.0: asp:Login

Hello
Could you help a beginner with login implementation using asp:Login
(.NET 2.0).
I have in Web.config:
<authentication mode="Forms">
<forms name="Demo.NET" loginUrl="Default.aspx" />
</authentication>
<authorization>
<allow users="demo"/>
<deny users="*"/>
</authorization>
In Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="DefaultPage" %>
...
<form id="LoginForm" method="post" action="Menu.aspx"
style="vertical-align: middle;" runat="server">
<asp:Login ID="DemoLogin" runat="server"
DestinationPageUrl="Menu.aspx"
TitleText="Logging in"
UserName="demo" UserNameLabelText="User"
PasswordLabelText="Password"
PasswordRequiredErrorMessage="Password required."
LoginButtonText="Login" LoginButtonType="Button"
RememberMeSet="true" RememberMeText="Remember me."
InstructionText="Enter: demo/demo."
FailureText="Failure. Try again."
OnLoggingIn="OnLoggingIn" />
</form>
...
And in Default.aspx.cs I have:
...
public partial class DefaultPage : System.Web.UI.Page
{
public void OnLoggingIn(object sender,
System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (DemoLogin.Password != "demo")
e.Cancel = true;
}
}
I don't understand why after enetring demo/demo on Default page I
receive failure message; OnLoggingIn() passes correctly.
How to correct the problem?
Thank you very much.
/RAM/
Mar 24 '06 #1
5 2007
On Fri, 24 Mar 2006 17:20:51 +0100, R.A.M. wrote:
I don't understand why after enetring demo/demo on Default page I
receive failure message; OnLoggingIn() passes correctly.
How to correct the problem?
Thank you very much.


I've already told you once. Don't use OnLoggingIn. Use OnAuthenticate
instead.
Mar 24 '06 #2
>I've already told you once. Don't use OnLoggingIn. Use OnAuthenticate
instead.

THANK YOU. I DID IT - IT WORKS FINE.
Mar 25 '06 #3
On Sat, 25 Mar 2006 07:19:19 +0100, R.A.M. <r_********@poczta.onet.pl>
wrote:
THANK YOU. I DID IT - IT WORKS FINE.

NO, THERE'S A PROBLEM.
After pressing Login button by the user, URL is changed to:
http://localhost:1047/Demo.NET/Defau...ET%2fMenu.aspx
(which does not work), while I expected:
http://localhost:1047/Demo.NET/Menu.aspx
(a have assigned to login control DestinationPageUrl = "Menu.aspx").
Could you explain me what's going on?
The user is not moved to Menu.aspx, so application doesn't work.
Could you help me please?
THANX A LOT.
/RAM/

Mar 25 '06 #4
On Sat, 25 Mar 2006 16:02:32 +0100, R.A.M. <r_********@poczta.onet.pl>
wrote:
On Sat, 25 Mar 2006 07:19:19 +0100, R.A.M. <r_********@poczta.onet.pl>
wrote:
THANK YOU. I DID IT - IT WORKS FINE.NO, THERE'S A PROBLEM.

..../RAM/


Sorry.
Mar 25 '06 #5
On Sat, 25 Mar 2006 16:02:32 +0100, R.A.M. wrote:
On Sat, 25 Mar 2006 07:19:19 +0100, R.A.M. <r_********@poczta.onet.pl>
wrote:
THANK YOU. I DID IT - IT WORKS FINE.

NO, THERE'S A PROBLEM.
After pressing Login button by the user, URL is changed to:
http://localhost:1047/Demo.NET/Defau...ET%2fMenu.aspx
(which does not work), while I expected:
http://localhost:1047/Demo.NET/Menu.aspx
(a have assigned to login control DestinationPageUrl = "Menu.aspx").
Could you explain me what's going on?
The user is not moved to Menu.aspx, so application doesn't work.
Could you help me please?
THANX A LOT.
/RAM/


You have not defined an authorization section in your web config to give
access to authenitcated users.

You need somethign like this:

<authorization>
<deny users="?" />
</authorization>
Mar 25 '06 #6

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

Similar topics

1
by: Wayne Smith | last post by:
Applies to: Microsoft FrontPage 2000, Microsoft Access 2000, IIS 5.0 Operating System: Microsoft Windows 2000 Professional I am trying to protect a portion of a web site by allowing users to...
4
by: R.A.M. | last post by:
I have a problem with logging in implementation in ASP.NET 2.0. I decided to use asp:Login control (which is enough), but I cannot find solution for handling logging in. I have an .aspx: <%@...
2
by: Sasquatch | last post by:
I'm having trouble creating a simple login page using the asp:login control. I followed some instructions in a WROX book, "Beginning ASP.NET 2.0," and the instructions are very straight forward,...
2
by: Sasquatch | last post by:
I'm still having trouble creating a simple login page using the asp:login control. I followed some instructions in a WROX book, "Beginning ASP.NET 2.0," and the instructions are very straight...
0
by: R.A.M. | last post by:
Hello, I have created asp:Login control on default.aspx page. In Page_Load() I wanted to initialize login name and password: LoginControl.UserName = ...; LoginControl.Password = ...; but I...
3
by: HeatherBMI | last post by:
I've been searching for a way to test this control with my NUnitASP tests for awhile now and have yet to come up with anything. I have all of my tests written, but until I can get past the initial...
1
by: Jman | last post by:
Is it possible to do a login from the code instead of using the interface (asp:login)?
3
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
The majority of pages on our site need authentication (forms auth against the aspnetdb database). I created an '~/auth' folder with its own config file forcing authentication for any pages in the...
2
by: zaifi | last post by:
I how to use asp login control with oracle databse..please explain me and source code.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.