473,809 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set userdata in auth ticket and still support cookieless authentication?

Hi.

I am working on an ASP.NET application and would like to support cookieless
forms authentication. Now there is a FormsAuthentica tion.SetAuthCoo kie
which, as I can see using reflector, takes into account the cookieless
status and sets the ticket either in a cookie or the URL. I want to store
some user data in the ticket, but the SetAuthCookie does not have a
parameter for custom data. What should I do?

From looking at this, it looks like I have two alternatives:
1) Implement the cookie vs. URL saving myself (possibly reverse engineering
the SetAuthCookie method). The problem with this is the there seems to be a
lot of helper classes and stuff like CookielessHelpe rClass that are
internal.
2) Use reflection to get access to the internal methods and call them
directly. The problem with this is that if the internal system changes,
than my code will break, but at least I would not have to implement lots of
code to do what I want.

So, is there a third alternative that the framework exposes? I would like
there to be a method as simple as SetAuthCookie which lets me pass some
userdata.


May 28 '06 #1
1 2233
cookiess sessions use url encoding via url rewriting. you can use your own
url rewriting on top of the session.

-- bruce (sqlwork.com)
"Peter Rilling" <pe***@nospam.r illing.netwrote in message
news:eS******** *********@TK2MS FTNGP03.phx.gbl ...
Hi.

I am working on an ASP.NET application and would like to support
cookieless forms authentication. Now there is a
FormsAuthentica tion.SetAuthCoo kie which, as I can see using reflector,
takes into account the cookieless status and sets the ticket either in a
cookie or the URL. I want to store some user data in the ticket, but the
SetAuthCookie does not have a parameter for custom data. What should I
do?

From looking at this, it looks like I have two alternatives:
1) Implement the cookie vs. URL saving myself (possibly reverse
engineering the SetAuthCookie method). The problem with this is the there
seems to be a lot of helper classes and stuff like CookielessHelpe rClass
that are internal.
2) Use reflection to get access to the internal methods and call them
directly. The problem with this is that if the internal system changes,
than my code will break, but at least I would not have to implement lots
of code to do what I want.

So, is there a third alternative that the framework exposes? I would like
there to be a method as simple as SetAuthCookie which lets me pass some
userdata.


Aug 3 '06 #2

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

Similar topics

1
6374
by: e | last post by:
I'm using forms authentication on a site. When the user logs in via the login page, the entered creds are checked against AD, and if valid, an encrypted forms authentication ticket is produced and stored in the forms auth cookie (and written to the client), using this code: ____________________ 'create the forms auth ticket objAuthTicket = New FormsAuthenticationTicket(1, txtUsername.Text, _ DateTime.Now, DateTime.Now.AddMinutes(8),...
8
1177
by: localhost | last post by:
Can sessions used be for Form Authentication instead of cookies? I am thinking of using Forms Authentication for locked-down browsers that do not allow cookies. Thanks.
2
6813
by: TK | last post by:
I have a trouble to get web resopnse from an aspx page which is secured by Forms Authentication with custom user account database. My client application is a console application but not a browser. I want to download a file from my webapplication. I've learned that the NetworkCredential class gives a way to go but no luck. My code is as following...just dump out the web response for debugging. // C# public void Download(string username,...
0
1518
by: Sean Patterson | last post by:
Hey all, I've followed the examples online on how to use Forms Authentication to create a ticket, assign it a role, and then intercept it in the Global.asax file to make sure it gets sucked in to the IPrincipal. This has worked on some other apps, but my code isn't working in my new one for some reason. Here's my CreateCredentials code: Private Sub CreateCredentials(ByVal UserID As String, ByVal UserRole As String)
4
1965
by: Jamie Pollard | last post by:
hello, i have been scouring the groups for the best possible solution to this problem, but can't seem to find my exact scenario, so hopefully someone can get me back on the right path. my situation is the following: i have a asp.net app that uses formsauthentication, and in the UserData field we store the role value of what the user is (ie admin, user, etc.). i want to also store the user id in this UserData field so i have added that...
13
2151
by: Perecli Manole | last post by:
In the forms authentication construct, I need a way to prevent ticket IssueDate and Expiration from being updated for a specific page only. By default forms authentication updates these two values whenever a page is requested and slides these values forward. Is there any way to forgo this proccess just for a specific page. I need this because this page is requested behind the scenes cheking for reminders for an Intranet application....
4
10273
by: dev648237923 | last post by:
Upon logon I create a ticket and put some userdata in it: FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 3, //Version tUsername.Text, //Username DateTime.Now, //Issue time DateTime.Now.AddHours(1), //Expires every hour false, //Don't persist cookie "test data" //User_SecureID ); //Hash the cookie for transport
2
1779
by: Steve | last post by:
I'm looking for feedback on an authentication solution we are considering for an ASP.NET 2.0 project. The site will be accessed by both internal users who are logged into the Windows domain, and external (business partner) users via the internet. The internal users are required to be authenticated via WIA, and external users will be authenticated using a custom solution based on a signed ticket that will be included as a query...
1
7092
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I am running ASP.NET 2.0, after login I need to pass CustomerID in my database instead of username to other pages. I added following code to my login.aspx protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { //FormsAuthentication.SignOut(); if (Membership.ValidateUser(Login.UserName, Login.Password)) { int customerID = GetCustomerIDByUsername(Login.UserName); if (customerID 0) {
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10640
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7662
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.