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

Home Posts Topics Members FAQ

Problem in forms auth, not going back to members page

1. Created a new C# web application project
2. Change the name of webform1 to login.aspx
3. And in the .cs file change the name of the class to login, and include
System.web.security namespace.
4. Place a textbox and a button in the login.aspx form.
5. Have the following code in the button click event.

if (true)
{
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, false)
}

6. Go to the web.config file, and change authentication from windows to Forms.

<authentication mode="Forms" />
and
<authorization>
<allow users="*" />
</authorization>

7. From the project menu, add new folder and name it as 'members'. Go to IIS
and
make this folder as an application.
8. Add a new webform to this sub-folder and name it as membersonly.aspx.
9. Place a label on the form.
10. Paste this code in the page load method.

if (Context.User.Identity.IsAuthenticated)
Label1.Text = "User Successfully Authenticated " + User.Identity.Name;
else
Label1.Text = "Authentication Failed. This Sucks";

11. With in this folder, add a new item, web.config file.
12. for authentication, paste this

<authentication mode="Forms">
<forms name="uslandcoauth" loginUrl="../Login.aspx" path="/"
protection="All"></forms>
</authentication>

13. for authorization, paste this

<authorization>
<deny users="?" />
</authorization>

Build the solution, open a browser and go to the membersonly.aspx page.
It gets redirected to login.aspx, this is fine because the user is not
authenticated.
Enter your name in the text box and click the button.
But it does not go to the membersonly.aspx page. It gets refreshed and shows
the same login page.

Jul 21 '05 #1
2 1700
Can any one tell me what is the problem with the above. I am working on this
for quite some time now and I am not able to figure out the problem.

TAI
Senthil

"Senthil" wrote:
1. Created a new C# web application project
2. Change the name of webform1 to login.aspx
3. And in the .cs file change the name of the class to login, and include
System.web.security namespace.
4. Place a textbox and a button in the login.aspx form.
5. Have the following code in the button click event.

if (true)
{
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, false)
}

6. Go to the web.config file, and change authentication from windows to Forms.

<authentication mode="Forms" />
and
<authorization>
<allow users="*" />
</authorization>

7. From the project menu, add new folder and name it as 'members'. Go to IIS
and
make this folder as an application.
8. Add a new webform to this sub-folder and name it as membersonly.aspx.
9. Place a label on the form.
10. Paste this code in the page load method.

if (Context.User.Identity.IsAuthenticated)
Label1.Text = "User Successfully Authenticated " + User.Identity.Name;
else
Label1.Text = "Authentication Failed. This Sucks";

11. With in this folder, add a new item, web.config file.
12. for authentication, paste this

<authentication mode="Forms">
<forms name="uslandcoauth" loginUrl="../Login.aspx" path="/"
protection="All"></forms>
</authentication>

13. for authorization, paste this

<authorization>
<deny users="?" />
</authorization>

Build the solution, open a browser and go to the membersonly.aspx page.
It gets redirected to login.aspx, this is fine because the user is not
authenticated.
Enter your name in the text box and click the button.
But it does not go to the membersonly.aspx page. It gets refreshed and shows
the same login page.

Jul 21 '05 #2
Not sure but try changing:

<forms name="uslandcoauth" loginUrl="../Login.aspx" path="/"
protection="All"></forms>

to use a relative path spec from the web root like "/Login.aspx" or
"/AppName/Login.aspx".

"Senthil" <Se*****@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
Can any one tell me what is the problem with the above. I am working on this for quite some time now and I am not able to figure out the problem.

TAI
Senthil

"Senthil" wrote:
1. Created a new C# web application project
2. Change the name of webform1 to login.aspx
3. And in the .cs file change the name of the class to login, and include System.web.security namespace.
4. Place a textbox and a button in the login.aspx form.
5. Have the following code in the button click event.

if (true)
{
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, false)
}

6. Go to the web.config file, and change authentication from windows to Forms.
<authentication mode="Forms" />
and
<authorization>
<allow users="*" />
</authorization>

7. From the project menu, add new folder and name it as 'members'. Go to IIS and
make this folder as an application.
8. Add a new webform to this sub-folder and name it as membersonly.aspx.
9. Place a label on the form.
10. Paste this code in the page load method.

if (Context.User.Identity.IsAuthenticated)
Label1.Text = "User Successfully Authenticated " + User.Identity.Name;
else
Label1.Text = "Authentication Failed. This Sucks";

11. With in this folder, add a new item, web.config file.
12. for authentication, paste this

<authentication mode="Forms">
<forms name="uslandcoauth" loginUrl="../Login.aspx" path="/"
protection="All"></forms>
</authentication>

13. for authorization, paste this

<authorization>
<deny users="?" />
</authorization>

Build the solution, open a browser and go to the membersonly.aspx page.
It gets redirected to login.aspx, this is fine because the user is not
authenticated.
Enter your name in the text box and click the button.
But it does not go to the membersonly.aspx page. It gets refreshed and shows the same login page.


Jul 21 '05 #3

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

Similar topics

9
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php';...
2
by: Brad | last post by:
Stupid question time: Why does Forms Auth just keep going to the login page when access is denied? A 403 error is never raised..at least in my testing it doesn't. If I have a particular web...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
6
by: Patrick Olurotimi Ige | last post by:
I have a Forms Auth and use a button that allows users to SignOut below but when they sign out and PRESS THE BACK BUTTON they can see the previous page WHY? Sub SignOut(objSender As Object,...
6
by: Jon | last post by:
If a session times out, but the forms auth is still logged in it's possible for users to go to pages on the site that need those session variables. I was under the impression that using forms auth...
2
by: Senthil | last post by:
1. Created a new C# web application project 2. Change the name of webform1 to login.aspx 3. And in the .cs file change the name of the class to login, and include System.web.security namespace....
8
by: =?Utf-8?B?TFc=?= | last post by:
Hello! I am just learning about forms authentication so please excuse this basic question. I am using .NET 1.1 and C#. I have created my web.config file and my login.aspx and the associated cs...
4
by: =?Utf-8?B?RmFyaWJh?= | last post by:
It know that we can use the following method http://msdn2.microsoft.com/en-us/library/eb0zx8fc.aspx to form authenticate across multiple applications. I have created an asp.net application...
0
by: mike | last post by:
We have a Access app that has been split with the backend on SQL 2k. We setup an ODBC connection on the clients to point to the SQL server and we are using NT Auth to connect to the SQL Server....
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...
1
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,...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.