473,386 Members | 1,817 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.

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 1697
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
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:
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: 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?
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,...

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.