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

How can I add my own data to a Web.FormsAuthentication cookie?

Rof
I am using FormsAuthentication.RedirectFromLoginPage(...) to give my
users a cookie, but I want to include other bits in the cookie, like
their name, what they are asking for, and so on. I have this in
Login.aspx:

System.Web.Security.FormsAuthentication.RedirectFr omLoginPage("Peter",
True)
Response.Cookies("Peter").Expires = Now.AddSeconds(60)
Response.Cookies("Peter")("whoami") = "Anon"

In the form it redirects to, I can only access
'Request.cookies("Peter")("whoami")' until the cookie expires - which
is logical. However, I still get sent straight there (no Login.aspx)
after the 60 seconds have expired. Does thes mean I have 2 different
cookies? If so, how can I get "whoami" and the expiry time into the
correct, FormsAuthentication cookie?

If the last 2 lines of code are these:

Response.Cookies(0).Expires = Now.AddSeconds(60)
Response.Cookies(0).Values.Add("whoami", "Anon")

Then it won't authenticate me at all, but keeps re-displaying
Login.aspx.

Help!
Peter Royle

Dec 7 '05 #1
0 830

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

Similar topics

9
by: buran | last post by:
Dear ASP.NET Programmers, How can I post data to an ASP.NET login page and pass authentication? The login page uses forms authentication, users must supply usernames and password and have to...
2
by: George Durzi | last post by:
When you call FormsAuthentication.SignOut(), is the FormsAuthentication cookie supposed to be destroyed automatically? I'm creating my FormsAuthentication cookie by doing: HttpCookie oCookie =...
1
by: ERamirez | last post by:
I downloaded the Portal Starter Kit of http://asp.net and started adding a few modules. All debuggin localy worked fine but once I put it onto a Windos Server 2003 I keep getting the following...
5
by: Åženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
10
by: buran | last post by:
Dear ASP.NET Programmers, How can I post data to an ASP.NET login page and pass authentication? The login page uses forms authentication, users must supply usernames and password and have to...
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:
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
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
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.