Cache User Details For The Duration Of Their Visit?

Jun 15, 2010

I've built a Repository that gets user details

Public Function GetUserByOpenID(ByVal openid As String) As User Implements IUserRepository.GetUserByOpenID
Dim user = (From u In dc.Users
Where u.OpenID = openid
Select u).FirstOrDefault
Return user
End Function

And I'd like to be able to pull those details down IF the user is logged in AND IF the cached data is null.

What is the best way to create a User object that contains all of the users details, and persist it across the entire site for the duration of their visit?

I Was trying this in my Global.asax, but I'm not really happy using Session variables. I'd rather have a single object with all the details inside.

Private Sub BaseGlobal_AcquireRequestState(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.AcquireRequestState
If Session("UserName") Is Nothing AndAlso User.Identity.IsAuthenticated Then
Dim repo As UrbanNow.Core.IUserRepository = New UrbanNow.Core.UserRepository
Dim _user As New UrbanNow.Core.User
_user = repo.GetUserByOpenID(User.Identity.Name)
Session("UserName") = _user.UserName()
Session("UserID") = _user.ID
End If
End Sub

View 1 Replies

Similar Messages:

C# - Clear Client Cache So When They Visit Website They Use Latest Javascript Files That Modify?

Mar 10, 2010

I have a website that i did some time ago now they request some new features and i did some changes in some javascript files, but when i publish the clients that use the IE have problems with cache so in they browser they have old version of javascript. How can i clear the client cache so when they visit website they use latest javascript files that i modify.

View 1 Replies

MVC :: Cache Duration And Location?

Oct 21, 2010

I am deciding to output cache my page and i need to set duration as never expiring. how can i achieve this? Also if i do not specify any location, where will the cache get stored? client or server? Ram or hard disk ?

View 4 Replies

UserControl: How To Set Output Cache Duration Programmatically?

Mar 22, 2010

UserControl: How to set Output Cache duration programaticaly?

View 2 Replies

Mobiles :: Switch Between Two Pages Depends On By Which Device User Visit?

Feb 19, 2011

Say that, there is a login.aspx page for any application. I would like to see this login page in different format if user visit by Iphone or any other mobile device. I have already designed two different page for test purposes. If i visit the page which is modified for Iphone, everything works fine.

what is the best way to switch between these two page depends on by which device user visit? These two pages could be even totally different two pages like black and white because of page layout issues.

View 2 Replies

Determining What Url The User Originally Entered To Visit A Web Page After Redirection?

Aug 17, 2010

Currently, I'm just using clientside Javascript (location.href), but I am wondering if there is a way in Asp.Net to figure out the URL the user originally entered (assume I did not change it myself via 301), or at least to track it in a simple and reliable manner. As I am using my own implementation of URL rewriting via the global.asax (e.g. Context.RewritePath), this is not an easy task, particularly since I don't want to touch it too much.


public override void Init()
this.BeginRequest += new EventHandler(Global_BeginRequest);
void Global_BeginRequest(object sender, EventArgs e)
if (VARIOUSCONDITIONS) Context.RewritePath("SOMEURL");
protected void Page_Init(object sender, EventArgs e)
//Request.RawUrl is equal to "SOMEURL", as
//are other properties that store the URL.

View 1 Replies

Forms Data Controls :: Want The User To Click Details And It Give Me A Pop-up Showing Details Of The Particular Row

Mar 11, 2011

I have a gridview control with a details column. I want the user to click details and it give me a pop-up showing details of the particular row. Any idea on how to do this using JQuery?? Looking for an example with code..

View 1 Replies

Data Controls :: Display DataList Item Details Like User Details With Image In JQuery Dialog Popup

Apr 14, 2014

I gone through your "Display details of ASP.Net DataList Item in jQuery Dialog Modal popup on button click" Example it is very nice but i want to Display image also With the information it can display i assign image src like

$("#imgpopup").html($("[id*=img]", $(this).closest("tr")).html());

imgpopp is the id belong from pop up. But Image canot be Display I tried it from te last Five Days. How to assign image source.

View 1 Replies

Saving Information For The Duration The User Has A Site Open?

Mar 27, 2011

How woulld I set this up:

I wanna save what links a user clicks on in a website. I thought of creating a jquery function that would save the link name everytime a link is clicked , then ajax the info to the db after the user closes the site.

Does that sound like a proper way. Anyone have samples of that?

Since there are multiple pages with multpile links, I wanna create something equivalient to a Session variable in javascript so I can append info to it everytime a user clicks a link and send the info only once to the db, instead of everytime a user clicks a link open a db connection and send the info.

The links are products so I wanna save related products, so I wanna save related product infomation. Maybe I need a cookie instead?

View 3 Replies

User Controls :: Resend Email With Details And Link After Adding Record By User

Apr 27, 2016

Into below code which is working fine, but the last section which started from using (SqlCommand SendMailcmd ... update it as i want when the user click on the button the code take the AdsID and (QAdsEmail "the user email") and send an e-mail to user depending on QAdsEmail and inside the email create a link to URL... so the user when he receive the mail he can click on it and move to the page to edit his Ad info ...

The table where below info will store in is called "ads" and the column that's need for sending email with ad info/the E-mail part of the code below i just copy it from another part of my application ...

protected void adNewQdadsbtn_Click(object sender, EventArgs e)
string FileExtentio = System.IO.Path.GetExtension(RegInteFileUploadImg1.FileName);
string FileExtentio2 = System.IO.Path.GetExtension(RegInteFileUploadImg2.FileName);
string FileExtentio3 = System.IO.Path.GetExtension(RegInteFileUploadImg3.FileName);
string FileExtentio4 = System.IO.Path.GetExtension(RegInteFileUploadImg4.FileName);
string FileExtentio5 = System.IO.Path.GetExtension(RegInteFileUploadImg5.FileName);


View 1 Replies

User Controls :: Save User Image And Display On Details Page

Dec 25, 2013

I have one application form in which i want to store image of student with enrollment no and when i submit i want to store that image and take that image on another page on submit button two things should be done 

1. storing the image and enrollment no
2. passing enrollment no and image to another page

View 1 Replies

Security :: Userid Of Newly Created User / To Store Additional Details Of The User In Another Database Table

Nov 10, 2010

Our application lets the administrator create new users. Since the administrator is logged in, I have set Logincreateduser = false so that the administrator is not logged out even after creating the new user.

The problem is :I need the userid of the newly created user to store additional details of the user in another database table. I see that i can get the username using Createuserwizard1.username; but how do I get the userID?

View 2 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
if (user == null)
user = (User)HttpContext.Current.Session["CurrentUser"]; //check if session[CurrentUser] is null here and log them out if so?
return user;
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

User Details Getting Stored Twice

Feb 9, 2011

Iam using 3.5 with c# coding in my application. I observed in all the aspx forms, whenever users clicks on Submit button, his details are getting stored and iam disabling the submit buton, but when he refreshes the form, still it is storing the same details again into the database. I Debugged the code and i checked that even at the time of Refresh it is going to Submit button code. How to avoid this at the time of refreshing the page.

View 3 Replies

Cache Combine Two User Data

Mar 15, 2011

I have a master/detail web form and i have implement a caching to hold detail data. i am facing problem that when two user login same time and enter data, cache has combined the data and both user ara getting each other data. i want every user gat his own data.

View 6 Replies

How To Avoid To Cache The User Control In Mvc

Nov 12, 2010

I add cache to my application, I have a page which contains several User Control, my problem is I just want to cache the data returned from Controller, but not want to cache all the page content. Since one of my user control is login control, if I cache all the result, then it will behave incorrectly.

my problem is :

1.Is it possible to just cache the data returned from controller ?

2.If a page is cached, can I force a control in the page to be uncached ?

View 2 Replies

C# - Cache Whole Result Set Or Based On User?

May 17, 2010

In my web application i have statistics which shown for each user separately ie. posts made , posts made today , articles started by and so on...

Each user has his own special statistics.

What is more flexible and "right" to work with one huge DataTable in Cache with whole data from all users and then loop thought DataTable to find certain user data or to cache each user ie. cacheObj + userID...

View 1 Replies

Web Forms :: Cache Or Not The User Basket?

Dec 26, 2010

I developed an ecommerce application.In this application (out of all other user products stuff ) use Sales to products

Here is simple demo:

For example
Buy 20 products and the other 2 product with 50% off

And another example
Buy 1 product and the other cost 9.99$

And last example
Baying more than 600$ got 20$ discount

Course calculate this is not so simple, and the GET BASKET event can take time

I wondered what the best way to do it. My 2 options are:

1. Try to cache the user basket.Yes - because this calculate make just one time (until the user change and add product to the basket etc')No - because this object keep on the server, and if I take a situation that many user fill their basket I don't want the server work slower because the consequence of this decision.

2. Of course the opposite to call this calculate each time than its make slow the make basket event but this not "sit" on the sever and I am not afraid of crash the server.

View 1 Replies

Keep Students Choices By The Next Visit?

Dec 15, 2010

On this page: student number: 10629 kan mark rows and make choices in dropdownlistsBy next visit i i would like the page to show earlier choises. Do i have to change everything or is there an easy option?Site code:


Stored procedure:


View 1 Replies

C# - Get User Details From OpenID Server?

May 31, 2010

I'm wanting to save some OpenId fields to a localdatabase table, such as

-Full Name
-openid url

how to get those attributes from openid server? send me some example code in, c#...

View 1 Replies

Web Forms :: Getting User Email Details From C#

Feb 7, 2010

When a user signs in to a site they enter their email address. Is it possible to gain access to the current users email from the code (c#)? I can see how to get the user's name

string myUser = User.Identity.Name; But... string myUserEmail = User.Identity.? It must be somewhere because the recover password can access it.

View 5 Replies

Getting User Active Directory Details?

Feb 15, 2011

I am building a simple intranet site and I want to get the user's Active Directory.

What steps do I need to take on the IIS side for this to work?

Are any changes required to my web config?

I would appreciate a detailed explanation, as this is giving me a hard time.

I have tryed things like this




the users will not login the page should be able to get the credentials without them typing their username and password windows authentication in my web config throws an error and causes my page not to work

View 1 Replies

Get User Details In Windows Authentication?

Oct 21, 2010

I am using windows Authentication and accessing user name as. IIdentity winId = HttpContext.Current.User.Identity; string name = winId.Name; but i want to get other details like User full name and EmailID.

View 4 Replies

State Management :: User Profile Cache?

Apr 5, 2010

I am looking for an elegant (i guess as elegant as it can be) solution to caching a users profile on login (whether it is session, cache, cookie, etc) and keeping it in sync when a users profile is changed. How do you guys handle this? Just simply call a Flush() method in your Save() method that invalidates the cache?

View 1 Replies

Web Forms :: Trying To Cache 2 User Control In Page?

Feb 11, 2011

i am trying to cache 2 user control in my page. These user control pulls inforamtion from Database and shows the information. (like top review etc).

It works fine if i dont add


in my user controls. but as soon as i add above code in my user controls then i get error.

Sys.ArgumentUndefineException: Value cannot be undefined. Parameter name:type

at the left bottom of the page.

This occurs when i navigate to different page and come back to page which has user control

View 1 Replies

Copyrights 2005-15, All rights reserved