473,469 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3492
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...
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.