Session, FormsAuthenticationTicket, Store Data About The User?

Feb 1, 2011

I'm am building an web application that needs to be able to scale.We want to store, an connection string, an object that says what organization the user is working on right now and the identity of the user.

We could serialize down this and send through the userdata property in the FormsAuthenticationTicket, but that feels to not be the optimal solution, cause its is 4-5 strings of data that is unncessesary, but the main issue is that we are sending an encrypted connectionstring to the user which we dosent want to.

So what are our options?Can ASP.NET Cache be our solution?, can we couple the expiration of the asp.net cache and the formsauthenticationcookie?

View 2 Replies


Similar Messages:

C# - How To Store Additional User Data Using MembershipProvider/FormsAuthenticationTicket

Aug 2, 2010

I have implemented my own custom MembershipProvider with a custom data store. No problems so far. I would like for people to login using their email instead of a username. Because I have my own data store, this is not a major issue, I can just pass the email as the username for the MembershipProvider.

My question is, how do I store additional custom user data along in the FormsAuthenticationTicket? I want to store a couple of things that will never change, such as their UserId, First/Last Name and Country. I started looking into creating FormsAuthenticationTicket with the UserData, but quickly got confused. How do I store multiple things into this UserData, and how do I easily read this data back on every single ASP.NET MVC2 page. I found many samples, none that really seemed that great in terms of MVC2. There has to be a simple way to do this.

It would make no sense to read the UserId, First/Last Name and the Country from a database on each and every request because it would never change. Plus, while I want the user to login using their email, I'd want to store their UserId in the auth cookie so that it can be used in nearly every user related database query rather than the email (because in all the tables, the user data is stored along with the UserId - not the email because technically the email could be changed - I already figured that stuff out when it comes to the MembershipProvider).

What is the best practices for storing additional user data like this in ASP.NET MVC2?

View 7 Replies

Forms Data Controls :: Store Gridview Datatable In Session And Then Retrieve From Session And Store Database

Nov 11, 2010

Its related to datatable in gridview store in session and then session retrive and store to database. basically i am using gridview here creating new row for button click and these row adding untill user's last entry then submit all these entry to database. so i want to use session variable to store this data temporarily and after final entry user click on submit button and all data shold be save in db.

View 9 Replies

Store Form Data In Tables For User Session?

Jan 5, 2010

I am using Visual Studio 2008.

I created a New Project ASP.NET Web Application.

I created a Textbox named VisitorName. The visitor puts in their name and it goes in VisitorName.Text

There is a Label that says "Which do you own?"

There is a RadioButtonList. It has Cat, Dog and None.

There is a button that says Add to list.

The button needs to add the results of the above items and put them in the list.

Now you keep adding people and their pets.

Once there are all entered you press send and I get the results for everyone entered during that session via email.

I have no database access and the information does not need to be stored in such a way.

I would like to use a datatable or datalist or something to that sort.

Oh and I would like the visitor to be able to click on a name in the table and edit the data using the form controls not in the datalist or datatable itself.

View 8 Replies

State Management :: How To Store A Large Amount Of Data In User's Session

Sep 29, 2010

I need to store a large amount of data in user's session but I guess using Session Object is not the best way of doing that. Is there any other way around??? Remember I don't have small variables to store, I have large collections.

View 5 Replies

Perform User Management (store User Info, Login , Logout Etc) Without Using Session Or Cookie?

Dec 1, 2010

Is it possible to perform user management (store user info, login , logout etc) without using session or cookie?

View 3 Replies

How To Store User ID In Session

Feb 15, 2011

When the user logs in, I want to store his userID in the session with

HttpContext.Current.Session["UserID"] = 2354; (this is just a hard-coded example)

Then, when I run a page method, if I do

var test = HttpContext.Current.Session["UserID"];

will the variable test hold the value I stored when he logged in?

If this is a correct way of doing it, how do I access the session when I receive a call from a page method? I want to put the test =... line in a page method to identify which user the request is coming from.

View 5 Replies

FormsAuthenticationTicket And Session Do Not Expire At The Same Time?

Feb 22, 2010

The thing is that in my web application user login form (FormsAuthenticationTicket) and a session variable which does not expire on time together ..!

I have a login page where I make a FormsAuthenticationTicket and a session ...

My problem after a little time out my session, but my FormsAuthenticationTicket not do it ..

Can I somehow do that when my session expires varbial so FormsAuthenticationTicket also will expired ..

Here in my login page and logout:

[Code]....

View 1 Replies

MVC :: How To Store Persistent-user-session Information's

Aug 8, 2010

i have a list of fields that i would store for all the user session. I thought to create a class, insert the information in it and store the class in the session but i'm not sure this is the best way to do it (performances, etc). I should have a list of these informations that i can display in views, i can delete and i can update. How could i do this?

View 10 Replies

Security :: How To Automatically Send User To Login Page When FormsAuthenticationTicket Expires

Feb 13, 2010

I'm using Forms authentication in my application but I'm not using the Membership that's built into .NET.

How do I automatically send user to login page when his/her FormsAuthenticationTicket expires? I just don't want a user log in and leave a page on their computer screen long after their session has expired. I'd like to make sure that as soon as the user's
FormsAuthenticationTicket has expired, I send them to login page.

View 1 Replies

Master Pages - Where's The Best Place To Store Custom "User" Object For The Duration Of Session

Jul 6, 2010

I have an ASP.NET application that needs to remember some info about a user (and what company they are from) across pages, within a session. I imagine this is a requirement of just about any ASP.NET application of a certain size. I've used a few different approaches over the years. In the past, I've passed around an id in querystring parameters like so: [URL] and then instantiated the object on each page (from the database). Another common way of doing it is storing my objects in session variables:

Session["User"] = currentUser; // store at login
User currentUser = (User)Session["User"]; // retrieve on some other page

which saves a trip to the DB, but I worry about memory used if the User object is complex and the site has many concurrent users. I have recently inherited an application that uses public properties on the master page, like this:

Master.theUser = currentUser; // store at login
User currentUser = Master.theUser; // retrieve on some other page

This saves the cast, and looks more readable to me I think, but I don't know if it's better or worse performance-wise. It also has some logic in the getter where if the private value is null, it tries to get it from the Session variable, though I'm not sure if that's never used (or used every get!?) or what. My latest idea is to use my page class. I have a custom page class derived from the standard System.Web.UI.Page base class. It includes objects like CurrentUser as public properties. This seems to work OK. I like it even better. But I really don't know what's going on under the covers. Can anyone give an opinion on which approach is better and why?

Update: I've done some checking use trace.axd and Trace.Write and it looks like neither the masterpage version nor the custom page class version "remember" the values between pages. The "get" methods have a line of code that checks if the User property is null, and if so, reads it from the session variable. This happens when a page accesses the property (Master.User or the derived class's this.User) for the first time on a given page, then subsequent requests can get the value (without going to the session variable). So thus far the best solution looks something like this:

public class MyPage : System.Web.UI.Page
{
private User user;
public User User
{
get
{
if (user == null)
{
user = (User)HttpContext.Current.Session["CurrentUser"]; //check if session[CurrentUser] is null here and log them out if so?
}
return user;
}
set
{
user = value;
HttpContext.Current.Session["CurrentUser"] = value;
}
}
}

Then on any webpage.aspx.cs, you can do something like this: UsernameTextBox.Text = User.FullName;

View 2 Replies

C# - Store Data From A Form For Recovery From The Session?

Feb 15, 2011

I need to store data from a form for recovery from the session.

Below is my rough first attempt for a generalized method for textboxes:

Load Session:

[code]....

However, it appears that the Controls collection is not working for me. What am I doing wrong?

this.Controls.OfType<TextBox>() yields no results at run time when I do a quick watch on it.

View 4 Replies

C# - Store Class Properties In Session And Use Of Session Handler - Is It Good Design

Jul 27, 2010

I have a class called EditMapUtilities. Here are some class properties that I want to persist:

public class EditMapUtlities
{
public static Boolean isInitialEditMapPageLoad
{
get { return SessionHandler.isInitialEditMapPageLoad; }
set { SessionHandler.isInitialEditMapPageLoad = value; }
}
// REST OF CLASS NOT GERMAIN TO DISCUSSION AND OMITTED
}

Here is my SessionHandler Class following the pattern from this post Static Session Class and Multiple Users:
using System.Web.SessionState;

public static class SessionHandler
{
private static HttpSessionState currentSession
{
get
{
if (HttpContext.Current.Session == null)
throw new Exception("Session is not available in the current context.");
else
return HttpContext.Current.Session;
}
}
//A boolean type session variable
private static string _isInitialEditMapPageLoad = "EditMapInitialPageLoad";
public static bool isInitialEditMapPageLoad
{
get
{
if (currentSession[_isInitialEditMapPageLoad] == null)
return true;
else
return (Boolean)currentSession[_isInitialEditMapPageLoad];
}
set
{
currentSession[_isInitialEditMapPageLoad] = value;
}
}
}

I am still learning OOAD. I want to keep relevant properties with relevant classes. I also want to keep all Session stored variables in one place for ease of maintenance and to encapsulate the session keys and calls. I feel like my design is too coupled though. How can I make it more loosely coupled? Is my editMapUtilities class too tightly coupled to the SessionHandler class? How would you do it better?

View 2 Replies

Where Should Store A Data Table ViewState/ Session/ Cache

Apr 21, 2010

I have a DataTable with about 10,000 rows in it.

I would like to store this data once for aspx page. When the user selects different options in the page, data is further selected from the already stored DataTable.

I tried using the ViewState, but as soon as the data grows beyond 100 rows, performance degrades.

View 1 Replies

Data Controls :: How To Store Session Variable In Database

Jul 23, 2013

i want to store  Session["Name"] into databse "name" column. how to do this ?

View 1 Replies

Forms Data Controls :: Select Data From Datalist Using Jquery And Store It In Session?

Mar 31, 2010

i am using a datalist in usercontrol.. i need to select data from datalist using jquery and store it in session?

View 2 Replies

Web Forms :: Store Large Data Using DataTables In Session Variables?

Apr 30, 2013

if i want to get multiple values from database and pass this dataset to another page can we use session to store the dataset values..i knw we can..but some one says that its not a gud approach..this will cause server process down..is it true?if it so then wat are all the other ways to do that?

View 1 Replies

Data Controls :: How To Store Data From Database In Session Variable

Nov 19, 2013

i have store data in the session and i want to insert that data to the database using sql server 2008.can i do this or not? if can, how can i?

View 1 Replies

Data Controls :: How Much Data Store In Session And Query String

Mar 15, 2014

How much data store in Session and query string? means what is the limit of Session and query string.

View 1 Replies

Where To Store And Set User Site Wide Data In MVC

Feb 16, 2010

I have an application in which a user can choose from different (learning)groups. User has only access to registered groups. When the user enters the site, he can choose (in a dropdown) which group he wants to see, so the complete site filters content related to that group. So every controller needs to access this global "group" object.What is the best way to do this in ASP.NET MVC? I've thought about a BaseController or ActionFilters. Is there any other best practice?I've build a WebForms application and there I used a BasePage so that any other page has access to the group.

View 2 Replies

Using SQL Membership Provider - Store Own Per - User Data?

Mar 27, 2010

I'm using the ASP.NET SQL Membership Provider. So, there's an aspnet_Users table that has details of each of my users. (Actually, the aspnet_Membership table seems to contain most of the actual data). I now want to store some per-user information in my database, so I thought I'd just create a new table with a UserId (GUID) column and an FK relationship to aspnet_Users. However, I then discovered that I can't easily get access to the UserId since it's not exposed via the membership API. (I know I can access it via the ProviderUserKey, but it seems like the API is abstracting away the internal UserID in favor of the UserName, and I don't want to go too far against the grain).

So, I thought I should instead put a LoweredUserName column in my table, and create an FK relationship to aspnet_Users using that. Bzzzt. Wrong again, because while there is a unique index in aspnet_Users that includes the LoweredUserName, it also includes the ApplicationId - so in order to create my FK relationship, I'd need to have an ApplicationId column in my table too. At first I thought: fine, I'm only dealing with a single application, so I'll just add such a column and give it a default value. Then I realised that the ApplicationId is a GUID, so it'd be a pain to do this. Not hard exactly, but until I roll out my DB I can't predict what the GUID is going to be. I feel like I'm missing something, or going about things the wrong way. What am I supposed to do?

View 3 Replies

Web Forms :: Store All Data Including Data From User Control Or Subroutine?

Oct 21, 2010

I have a user control with data of person. iN this user control is subroutine which storing data to database of person.On my ASPX page I've implemented this control and another form with data which ii'm storing.On button click on ASPX page, i want to store all my data including data from my user control or subroutine in that user control which storing data of person.I want to make sqltransaction, so only one connection for aspx page and user control.ASPX.vb

[code]...

The point of my question is how to interact between my class where i have methods and user conttorl on aspx page.

View 5 Replies

Forms Data Controls :: Modal Popup - Store Data Temporary Until User Click Save In Parent Gridview

Nov 5, 2010

I have one parent gridview where each record will link to its details page (another child gridview in modal popup). May I know how do I store the values of the child gridview temporary (maybe in session) and repopulate the data into the parent gridview? Current problem is: once I click save in the child modalpop gridview, it binds the parent gridview before the child gridview data is stored in session. I want to store the data temporary until user click save in the parent gridview.

View 4 Replies

Web Forms :: Store Values In Session Array And Get Back The Values From Session ?

Oct 1, 2010

i have two text boxes and one button in web form. I need to display the contents of text boxes in a datatable in the same form, when i click on the button.

How can i do this using session array. I need to store values in session array. and get back the values from session when i need .

View 2 Replies

Forms Data Controls :: Store Attendance Status Based On The User Selection?

Jan 26, 2010

I am currently trying to implement a small class attendance system, where the student names are taken from a database, stored in a List<Student>, and bound to a Repeater control. Each row of the Repeater contains two columns: The first is the student's name, and the remaining column contains a RadioButtonList with three ListItems (Present, Absent, Sick).Now, once the user presses "Submit", I want to be able to store their attendance status based on the user selection. However, after submission, the SelectedIndex is always 0, no matter what option is selected.

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved