开发者

session related question in asp.net

开发者 https://www.devze.com 2023-02-26 10:40 出处:网络
1) re-login in asp.net In my application,I do not want two user login with the same login name. For example, user1 login with name \"test1\",then user2 try to login with \"test1\" too,but at this mo

1) re-login in asp.net

In my application,I do not want two user login with the same login name.

For example, user1 login with name "test1",then user2 try to login with "test1" too,but at this moment the user1's session does not expire,so the login of user2 should be denied.

开发者_StackOverflow社区

No my question is how to check if the user1's session is expire or not when user2 try to login?

2)the timeout property of formauthentication VS seesionstate

what is the difference? I have googled,but I am not sure how to use them.

it seems that the session have some realationship with the cookie,so when a session come to the server side,sometime we have to check if this session is a new session or not,I wonder when we have to check this?

3) Global.asax

There is a method:

Application_Start(object sender, EventArgs e)

What does the application start mean? the iis?


To get all user session here is a tutorial with code.

http://weblogs.asp.net/imranbaloch/archive/2010/04/05/reading-all-users-session.aspx

formauthentication VS seesionstate

I think that this is very clear, you have 2 different variables. The formauthentication says how many times keeps you login, and the sessionstate says how many times keeps your session data. The asp.net keeps 2 different cookies to connect a user with the authentication and with the session and the expires is referred to this cookies on the user computer.

it seems that the session have some realationship with the cookie

Of cource he has, how else the server can make relation of the session data with the specific user ? using cookies. You need to check for new session every time the session is null !

The

Application_Start(object sender, EventArgs e)

fires when your application starts.

For example, when you open the appoffline.htm, your app stops, when you close it your app starts again, when the pool of your application make a restart because of the settings, when you upload new files and your applications make a restart for after the compile, and when you make a restart from iis, and of course when you restart your iis, or when you computers boot.

0

精彩评论

暂无评论...
验证码 换一张
取 消