473,395 Members | 1,738 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.

System.Web.Security.FormsAuthentication.RedirectFr omLoginPage is not working..

Thanks in advance,

What I did was

1. add these lines in web.cofig file
<authentication mode="Forms">
<forms name="frmAuthentication" loginUrl="login.aspx"
protection="All" path="/" />
</authentication>
<authorization>
<deny users="*" /> <!-- Allow all users -->
</authorization>

2. create login.aspx and default.aspx
3. add this line in login.aspx for submit click event
Dim theUser As New Online_Employment_Manager_Business.User()

If theUser.Login(txtUserName.Text, txtPassword.Text)Then
System.Web.Security.FormsAuthentication.RedirectFr omLoginPage(txtUserNam
e.Text, True)
Else
'Login failed - show the message
Page.RegisterStartupScript("LoginFailed", "<script
language=""JavaScript"">alert('Login Failed.\n\nPlease check your login
information and try again.');</script>")
End If

although theUser.Login passed True the page remains in login.aspx.

Did I miss something?

Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
1 3488
You have error in the web.config.

This setting:
<authorization>
<deny users="*" /> <!-- Allow all users -->
</authorization>

denies all access to the protected pages, despite is the user authenticated
or not. It should be:

<authorization>
<deny users="?" /> <!-- Allow authenticated users -->
</authorization>

In this case only unauthenticated users are redirected to the login page.

--
Teemu Keiski
MCP,Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

Email:
jo****@aspalliance.com

"TaeHo Yoo" <an*******@devdex.com> kirjoitti viestissä
news:Oi****************@TK2MSFTNGP11.phx.gbl...
Thanks in advance,

What I did was

1. add these lines in web.cofig file
<authentication mode="Forms">
<forms name="frmAuthentication" loginUrl="login.aspx"
protection="All" path="/" />
</authentication>
<authorization>
<deny users="*" /> <!-- Allow all users -->
</authorization>

2. create login.aspx and default.aspx
3. add this line in login.aspx for submit click event
Dim theUser As New Online_Employment_Manager_Business.User()

If theUser.Login(txtUserName.Text, txtPassword.Text)Then
System.Web.Security.FormsAuthentication.RedirectFr omLoginPage(txtUserNam
e.Text, True)
Else
'Login failed - show the message
Page.RegisterStartupScript("LoginFailed", "<script
language=""JavaScript"">alert('Login Failed.\n\nPlease check your login
information and try again.');</script>")
End If

although theUser.Login passed True the page remains in login.aspx.

Did I miss something?

Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2

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

Similar topics

11
by: David W. Simmonds | last post by:
I have a form that will prompt for a user name/password. In VS.NET, I have the protected form in a folder named Admin. I have a Web.config file in that folder as well. It contains the following...
1
by: Danny | last post by:
Hi there, I was wondering if anyone would be able to shed some light on the following behaviour for me. I have an application that is using Forms Authentication with non-persistent cookies, a...
2
by: Ben Fidge | last post by:
Is FormsAuthentication.RedirectFromLoginPage the only way to populate the HttpContext.Current.User.Identity.Name property? A base class for each page contains the follwoing property: public...
3
by: Phil Certain | last post by:
Hi I'm building a site that has publicly available pages and password protected pages. Publicly available pages reside in: /public and password protected pages reside in: /private
2
by: tshad | last post by:
I have a logon page that is may be called by the Forms Authentication setup. This would put a ReturnURL as part of the URL. I would normally then just issue a: ...
2
by: Grant Merwitz | last post by:
Hi, i am using forms authentication in an ASP.NET project I am setting the Forms authentication cookie by using: FormsAuthentication.RedirectFromLoginPage(UserName.Text, false); Now when i...
5
by: BoltonWolf | last post by:
Hi, I have a ASP.Net web site, that we sell as a module to our core software, versions of this site are running fine on many servers, however we are having problems with our latest installtion,...
1
by: Jeremy Chapman | last post by:
I have built a web app. While testing I have found that if I browse to a page in the app, then get redirected to the login page and enter my credentials. The...
0
by: Imran Aziz | last post by:
Hello All, I cannot seem to get createPersistentCookie option of FormsAuthentication.RedirectFromLoginPage work. Even if I set it to true the cookie is setup to expire after 30 min ( default...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...
0
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—planning, coding, testing,...

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.