473,325 Members | 2,785 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,325 software developers and data experts.

piggy-back on Forms Authentication cookie?

Using Forms Authentication, I'd like to 'piggy-back' a small piece of
information onto the authentication cookie.

I tried the following, but this seems to invalidate the cookie, so
IsAuthenticated becomes false:
System.Web.Security.FormsAuthentication.SetAuthCoo kie(Username, False)

Dim secCookie As HttpCookie

secCookie = HttpContext.Current.Response.Cookies("Tenni") ' "Tenni" is
the name of the auth cookie

secCookie("F") = myFacilityID.ToString '<<<piggy-back info

Any ideas out there? Thanks,

Paul.


Nov 19 '05 #1
3 1419

Hi Paul:

you can piggyback data in the cookie, but since the forms auth cookie
is encrypted and hashed to prevent tampering it takes some extra work.
I believe this document will help you out:
http://www.pluralsight.com/articleco...entication.pdf

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 28 Feb 2005 07:46:11 -0500, "Paul W" <qq*@qqq.com> wrote:
Using Forms Authentication, I'd like to 'piggy-back' a small piece of
information onto the authentication cookie.

I tried the following, but this seems to invalidate the cookie, so
IsAuthenticated becomes false:
System.Web.Security.FormsAuthentication.SetAuthCo okie(Username, False)

Dim secCookie As HttpCookie

secCookie = HttpContext.Current.Response.Cookies("Tenni") ' "Tenni" is
the name of the auth cookie

secCookie("F") = myFacilityID.ToString '<<<piggy-back info

Any ideas out there? Thanks,

Paul.


Nov 19 '05 #2
Looking at what you are aiming to do, I see no reason you should place this
in the forms auth cookie. I can, however, understand, the thought process.

Authentication coookies are encrypted, so you cannot simply add a field to
them. If you desire additional information in this particular cookie, rather
than persisting by user ID on the server (a better idea), your best bet is to
add the information via a custom provider.

The main question is whether or not the 2.0 Framework (waiting for this
summer?) is an option, as the entire concept of membership is abstracted for
you in 2.0. It is not necessarily a fix to the way you want to do things, but
should solve your issue. To retro 1.x with the necessary info (except storing
additional info on your server) is a bit of a pain. Just my two cents.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Paul W" wrote:
Using Forms Authentication, I'd like to 'piggy-back' a small piece of
information onto the authentication cookie.

I tried the following, but this seems to invalidate the cookie, so
IsAuthenticated becomes false:
System.Web.Security.FormsAuthentication.SetAuthCoo kie(Username, False)

Dim secCookie As HttpCookie

secCookie = HttpContext.Current.Response.Cookies("Tenni") ' "Tenni" is
the name of the auth cookie

secCookie("F") = myFacilityID.ToString '<<<piggy-back info

Any ideas out there? Thanks,

Paul.


Nov 19 '05 #3
Remarkable find! Exactly what I was looking for. It even uses the phrase "
Piggybacking data with FormsAuthenticationTicket"

Thanks,

Paul.

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:er********************************@4ax.com...

Hi Paul:

you can piggyback data in the cookie, but since the forms auth cookie
is encrypted and hashed to prevent tampering it takes some extra work.
I believe this document will help you out:
http://www.pluralsight.com/articleco...entication.pdf

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 28 Feb 2005 07:46:11 -0500, "Paul W" <qq*@qqq.com> wrote:
Using Forms Authentication, I'd like to 'piggy-back' a small piece of
information onto the authentication cookie.

I tried the following, but this seems to invalidate the cookie, so
IsAuthenticated becomes false:
System.Web.Security.FormsAuthentication.SetAuthC ookie(Username, False)

Dim secCookie As HttpCookie

secCookie = HttpContext.Current.Response.Cookies("Tenni") ' "Tenni"
is
the name of the auth cookie

secCookie("F") = myFacilityID.ToString '<<<piggy-back info

Any ideas out there? Thanks,

Paul.

Nov 19 '05 #4

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

Similar topics

3
by: tm | last post by:
Hello, I have to to scan c-code, look for a c-struct variable(declaration) and represent the struct in a tree-graphic. Are there modules for scanning c-code and graphictools for the...
0
by: Tim Newsham | last post by:
Announcing: PyGgy v0.3 - http://www.lava.net/~newsham/pyggy/ Tim Newsham 2004 Jul 15 Public Domain ---[ Description PyGgy is a python package for generating parsers and lexers in python.
31
by: Antoon Pardon | last post by:
I have been working with unittests lately and found that the self.failUnlessAlmostEqual, isn't as usefull as it could be. My main problem is, that it is only usefull with objects that can be...
14
by: Ben | last post by:
This is an exercise from the Non-programmers tutorial for Python by Josh Cogliati. The exercise is: Write a program that has a user guess your name, but they only get 3 chances to do so until...
0
by: Paul Littlefield | last post by:
Hi How do I select from a single table using 2 columns (surname,postcode) as the unique criteria? e.g. "Surname","Forename","Salutation","Postcode" "Bear","Daddy","Mr","CT10 7AF"...
0
by: gsb58 | last post by:
Hi! I have a little problem with the registry function. The function is supposed to check the registry as the main form is activated. If there is a key it should not write to the registry, as it...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
78
by: Robert Baer | last post by:
The homepage i have had up and seemingly working is: http://oil4lessllc.com/ However, the validator has so many complaints, and being so incompetent, i have no clue as to how to fix it all. Would...
7
by: skip | last post by:
A guy at work asked for functionality commonly found with rational numbers, so I said I'd find and install something. I figured gmpy would be suitable, alas I'm having trouble successfully...
20
by: piggy | last post by:
I have developed an application using C# under .NET 2.0 framework. It is almost done and it is time for me to think about deploymnet to all users. I don't have any background about this and would...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.