473,386 Members | 1,819 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,386 software developers and data experts.

Problems Redirecting from a Login Page

Hi,

I am have problems redirecting from a login page. The login page is simple,
with just 2 textboxes and one button. On the button click the routine below
is called:

I am using:
Visual Studio 2003 Version 7.1.3008
Framework 1.1 Version 1.1.4322 SP1
Windows XP Pro Version 2002 SP2

I have tried two ways:

protected void LoginUser(Object s,EventArgs e)
{

if(FormsAuthentication.Authenticate(Username.Text, Password.Text))
{

-------- First Way------------
// Redirect to requested URL, or homepage if no previous page
requested
string returnUrl = Request.QueryString["ReturnUrl"];

if (returnUrl == null)
returnUrl = "Home.aspx";

Response.Redirect(returnUrl);

-------- Second Way------------
FormsAuthentication.RedirectFromLoginPage(Username .Text,true) ;
}
}

Below is part of the Web.config for authentication and authorization

<authentication mode="Forms">

<forms name=".LoginCookie" loginUrl="login.aspx" protection="All"
timeout="40" path="/">

<credentials passwordFormat="Clear">

<user name="gwc" password="qfbxra"></user>

</credentials>

</forms>

</authentication>

<authorization>

<allow users="?"></allow>

<deny users="*"></deny> <!-- Used to override <allow
users="*"></allow> in machine.config-->
</authorization>

I searched the web about this problems and have not found any solutions
that work.

Does anyone have any suggestions as I am losing the will to live

Cheers

gwc




Dec 6 '05 #1
2 1970
In Web.config, it should be

<authorization>
<deny users="?" /> <!-- deny anonymous users, otherwise
FormsAuthentication object never works -- >
<allow users="*" /> <!-- Used to override -->
</authorization>
HTH

Elton Wang

"Gary Coutts" wrote:
Hi,

I am have problems redirecting from a login page. The login page is simple,
with just 2 textboxes and one button. On the button click the routine below
is called:

I am using:
Visual Studio 2003 Version 7.1.3008
Framework 1.1 Version 1.1.4322 SP1
Windows XP Pro Version 2002 SP2

I have tried two ways:

protected void LoginUser(Object s,EventArgs e)
{

if(FormsAuthentication.Authenticate(Username.Text, Password.Text))
{

-------- First Way------------
// Redirect to requested URL, or homepage if no previous page
requested
string returnUrl = Request.QueryString["ReturnUrl"];

if (returnUrl == null)
returnUrl = "Home.aspx";

Response.Redirect(returnUrl);

-------- Second Way------------
FormsAuthentication.RedirectFromLoginPage(Username .Text,true) ;
}
}

Below is part of the Web.config for authentication and authorization

<authentication mode="Forms">

<forms name=".LoginCookie" loginUrl="login.aspx" protection="All"
timeout="40" path="/">

<credentials passwordFormat="Clear">

<user name="gwc" password="qfbxra"></user>

</credentials>

</forms>

</authentication>

<authorization>

<allow users="?"></allow>

<deny users="*"></deny> <!-- Used to override <allow
users="*"></allow> in machine.config-->
</authorization>

I searched the web about this problems and have not found any solutions
that work.

Does anyone have any suggestions as I am losing the will to live

Cheers

gwc




Dec 7 '05 #2
Hi Elton,

Thanks for the reply.

My mistake my web.config should have read

<deny users="?" /> <!-- deny anonymous users, otherwise

I had been playing around and forgot to return to the original config.
I tried replacing the

<deny users="*"/>

with your suggested

<allow users="*"/>

but now it gives me access to any of the page without going to the login
page.

Cheers

Gary
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
In Web.config, it should be

<authorization>
<deny users="?" /> <!-- deny anonymous users, otherwise
FormsAuthentication object never works -- >
<allow users="*" /> <!-- Used to override -->
</authorization>
HTH

Elton Wang

"Gary Coutts" wrote:
Hi,

I am have problems redirecting from a login page. The login page is
simple,
with just 2 textboxes and one button. On the button click the routine
below
is called:

I am using:
Visual Studio 2003 Version 7.1.3008
Framework 1.1 Version 1.1.4322 SP1
Windows XP Pro Version 2002 SP2

I have tried two ways:

protected void LoginUser(Object s,EventArgs e)
{

if(FormsAuthentication.Authenticate(Username.Text, Password.Text))
{

-------- First Way------------
// Redirect to requested URL, or homepage if no previous page
requested
string returnUrl = Request.QueryString["ReturnUrl"];

if (returnUrl == null)
returnUrl = "Home.aspx";

Response.Redirect(returnUrl);

-------- Second Way------------
FormsAuthentication.RedirectFromLoginPage(Username .Text,true) ;
}
}

Below is part of the Web.config for authentication and authorization

<authentication mode="Forms">

<forms name=".LoginCookie" loginUrl="login.aspx" protection="All"
timeout="40" path="/">

<credentials passwordFormat="Clear">

<user name="gwc" password="qfbxra"></user>

</credentials>

</forms>

</authentication>

<authorization>

<allow users="?"></allow>

<deny users="*"></deny> <!-- Used to override <allow
users="*"></allow> in machine.config-->
</authorization>

I searched the web about this problems and have not found any solutions
that work.

Does anyone have any suggestions as I am losing the will to live

Cheers

gwc




Dec 7 '05 #3

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

Similar topics

1
by: Stu | last post by:
Hi All, I have an ASP.NET application to which I have implemented forms authentication to handle security. It is a relatively straight forward solution with all aspx pages residing in the root...
4
by: jjjooooohhnnn | last post by:
Greetings, I have encountered what appears to be a fairly common problem: RedirectFromLoginPage is not redirecting to RedirectUrl. I have tried all the advice that I could on the 'net, and...
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...
3
by: Katie | last post by:
Hi, I want to be able to send users links to pages in my website. But if they arent logged in I want them to first be redirected to the login page and after they login automatically be...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
9
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will...
0
by: Anup Daware | last post by:
Hi All, I am facing this very weird issue, for every server request my control is redirecting to the login page and again coming back to the actual page from where the request was initiated when I...
6
by: rpcchandu | last post by:
Hi Coders, I have to redirect from my server to the different server page by simulating the POST method submit from the Controller file, I tried using post_via_redirect, but could not succeed......
4
by: PHPstarter | last post by:
Basicly we're at a navigation page with a lot of different links. Clicking one of the links will lead you to a new index, but you would only be able to view the index if you are already logged in....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.