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 -
FormsAuthenticationTicket authTicket = new
-
-
FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToString(),f
-
alse,10);
-
-
//Encrypt the ticket
-
string eT = FormsAuthentication.Encrypt(authTicket);
-
//Create a Cookie and store the data
-
HttpCookie authCookie = new
-
HttpCookie(FormsAuthentication.FormsCookieName,eT);
-
DateTime dt = DateTime.Now;
-
authCookie.Expires = dt.AddHours(1);
-
Response.Cookies.Add(authCookie);
-
-
//Redirect to Originally Requested Page
-
Label2.Text = (FormsAuthentication.GetRedirectUrl
-
(selectCMD.Parameters["@output"].Value.ToString(),false));
-
Response.Redirect(FormsAuthentication.GetRedirectUrl
-
(selectCMD.Parameters["@output"].Value.ToString(),false))
-
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
- FormsAuthenticationTicket authTicket = new
- FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToStri
- ng(),f alse,10);
- //Encrypt the ticket
- string eT = FormsAuthentication.Encrypt(authTicket);
- //Create a Cookie and store the data
- HttpCookie authCookie = new
- HttpCookie(FormsAuthentication.FormsCookieName,eT);
- DateTime dt = DateTime.Now;
- authCookie.Expires = dt.AddHours(1);
- Response.Cookies.Add(authCookie);
- //Redirect to Originally Requested Page
- Label2.Text = (FormsAuthentication.GetRedirectUrl
- (selectCMD.Parameters["@output"].Value.ToString(),false));
- Response.Redirect(FormsAuthentication.GetRedirectUrl
- (selectCMD.Parameters["@output"].Value.ToString(),false))
-
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
- > FormsAuthenticationTicket authTicket = new
- > FormsAuthenticationTicket(selectCMD.Parameters["@output"].Value.ToStri
- > ng(),f alse,10);
- >
- > //Encrypt the ticket
- > string eT = FormsAuthentication.Encrypt(authTicket);
- > //Create a Cookie and store the data
- > HttpCookie authCookie = new
- > HttpCookie(FormsAuthentication.FormsCookieName,eT);
- > DateTime dt = DateTime.Now;
- > authCookie.Expires = dt.AddHours(1);
- > Response.Cookies.Add(authCookie);
- > //Redirect to Originally Requested Page
- > Label2.Text = (FormsAuthentication.GetRedirectUrl
- > (selectCMD.Parameters["@output"].Value.ToString(),false));
- > Response.Redirect(FormsAuthentication.GetRedirectUrl
- > (selectCMD.Parameters["@output"].Value.ToString(),false))
- >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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:
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |