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

Forms Authentication Not Working

I have something weird hapenning on my forms authentication, which to me
seems to be straight out of the MS help files

After the user logs in, they shoul dbe redirected to the resource they were
trying to reach. But all that happens is that they are reirected back to the
login page.

From trial and error, I believe that the cookie is never being created and
written.

In case this is an issue, my Browser has minimum security, and allows
cookies, and my firewall is turned off.

So, is the code below sufficient for my task, and if so, any more ideas as
to why it might not be working?

Matt

Expand|Select|Wrap|Line Numbers
  1. FormsAuthenticationTicket authTicket = new
  2.  
  3. FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToString(),f
  4. alse,10);
  5.  
  6. //Encrypt the ticket
  7. string eT = FormsAuthentication.Encrypt(authTicket);
  8. //Create a Cookie and store the data
  9. HttpCookie authCookie = new
  10. HttpCookie(FormsAuthentication.FormsCookieName,eT);
  11. DateTime dt = DateTime.Now;
  12. authCookie.Expires = dt.AddHours(1);
  13. Response.Cookies.Add(authCookie);
  14.  
  15. //Redirect to Originally Requested Page
  16. Label2.Text = (FormsAuthentication.GetRedirectUrl
  17. (selectCMD.Parameters["@output"].Value.ToString(),false));
  18. Response.Redirect(FormsAuthentication.GetRedirectUrl
  19. (selectCMD.Parameters["@output"].Value.ToString(),false))
  20.  

Nov 19 '05 #1
2 1010
Hi Matt,

I will try your code later this evening. Is it still a problem?

Cheers,
Tom Pester
I have something weird hapenning on my forms authentication, which to
me seems to be straight out of the MS help files

After the user logs in, they shoul dbe redirected to the resource they
were trying to reach. But all that happens is that they are reirected
back to the login page.

From trial and error, I believe that the cookie is never being created
and written.

In case this is an issue, my Browser has minimum security, and allows
cookies, and my firewall is turned off.

So, is the code below sufficient for my task, and if so, any more
ideas as to why it might not be working?

Matt

Expand|Select|Wrap|Line Numbers
  1.  FormsAuthenticationTicket authTicket = new
  2.  FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToStri
  3.  ng(),f alse,10);
  4.  //Encrypt the ticket
  5.  string eT = FormsAuthentication.Encrypt(authTicket);
  6.  //Create a Cookie and store the data
  7.  HttpCookie authCookie = new
  8.  HttpCookie(FormsAuthentication.FormsCookieName,eT);
  9.  DateTime dt = DateTime.Now;
  10.  authCookie.Expires = dt.AddHours(1);
  11.  Response.Cookies.Add(authCookie);
  12.  //Redirect to Originally Requested Page
  13.  Label2.Text = (FormsAuthentication.GetRedirectUrl
  14.  (selectCMD.Parameters["@output"].Value.ToString(),false));
  15.  Response.Redirect(FormsAuthentication.GetRedirectUrl
  16.  (selectCMD.Parameters["@output"].Value.ToString(),false))
  17.  

Nov 19 '05 #2
Yes, it is still a problem, thanks.

Matt

<To********************@pandora.be> wrote in message
news:a1**************************@news.microsoft.c om...
Hi Matt,

I will try your code later this evening. Is it still a problem?

Cheers,
Tom Pester
I have something weird hapenning on my forms authentication, which to
me seems to be straight out of the MS help files

After the user logs in, they shoul dbe redirected to the resource they
were trying to reach. But all that happens is that they are reirected
back to the login page.

From trial and error, I believe that the cookie is never being created
and written.

In case this is an issue, my Browser has minimum security, and allows
cookies, and my firewall is turned off.

So, is the code below sufficient for my task, and if so, any more
ideas as to why it might not be working?

Matt

Expand|Select|Wrap|Line Numbers
  1.  > FormsAuthenticationTicket authTicket = new
  2.  > FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToStri
  3.  > ng(),f alse,10);
  4.  >
  5.  > //Encrypt the ticket
  6.  > string eT = FormsAuthentication.Encrypt(authTicket);
  7.  > //Create a Cookie and store the data
  8.  > HttpCookie authCookie = new
  9.  > HttpCookie(FormsAuthentication.FormsCookieName,eT);
  10.  > DateTime dt = DateTime.Now;
  11.  > authCookie.Expires = dt.AddHours(1);
  12.  > Response.Cookies.Add(authCookie);
  13.  > //Redirect to Originally Requested Page
  14.  > Label2.Text = (FormsAuthentication.GetRedirectUrl
  15.  > (selectCMD.Parameters["@output"].Value.ToString(),false));
  16.  > Response.Redirect(FormsAuthentication.GetRedirectUrl
  17.  > (selectCMD.Parameters["@output"].Value.ToString(),false))
  18.  > 


Nov 19 '05 #3

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

Similar topics

11
by: ElmoWatson | last post by:
I tried on the Security newgroup, as well as other places, and haven't gotten an answer yet - - I'm pulling my hair out over this one. I'm trying to get Forms Authentication working.....I can get...
3
by: Andrew Robinson | last post by:
Is there any way to dynamically set the timeout while using forms based authentication? I want to change this value depending on the type of user that logs into my system. I understand that this...
4
by: =?Utf-8?B?R3V1czEyMw==?= | last post by:
Hi, I created a web site on a remote server. To logon the user must enter a user id and password. The site is uses Forms Authentication. The web config file looks as follows: ...
2
by: Max2006 | last post by:
Hi, We prefer ASP.NET Forms Authentication in our ASP.NET 3.5 application; however we have to use Active Directory for user name and password storage. Is that possible? Is there any sample...
5
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?

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.