ASP.NET简单的用户登录 [英] ASP.NET Simple User Login

查看:92
本文介绍了ASP.NET简单的用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是简单的登录屏幕,用户登录在asp.net中形式的C#屏幕。

I am using a simple login screen for users to login screen in asp.net forms c#.

我知道如何有效,使得用户都有一个唯一的用户名等
我能做到这一点很容易。

I know how to valid so that the user has a unique username, etc. I can do this easily.

我的问题是,一旦用户登录,怎么我的Valide用户
在不同的页面之间。请记住,我没有使用内置的asp.net成员和角色表心意(有一些原因,我不想使用它)。

My question is that once the user is logged in, how to I valide the user between the different page. Keep in mind that I am not using the built in asp.net Membership and Roles table (There are some reasons why I do not want to use it).

我的想法是,一​​旦用户登录,只需有一个会话变量设置和检查需要访问权限不同的页面上。如果我有一个有效的会话,然后我可以让用户查看页面。

My thought was that once the user is logged in, to simply have a session variable setup and check that on the different page that require access permission. If I have a valid session then I can let the user view the page.

我可以这样做:

       Session["ValidUser"] = "ValidUser";

这是我不知道的一件事是,登陆后10小时内用户视图站点。我该如何调整,从而使会话不会超时。也就是会话变量,以最好的一段路要走。

One thing that I am not sure about is that the user view site for 10 hours after login. How do I adjust it so that the session will not timeout. Also is the session variable the best way to go.

感谢

推荐答案

会议是在asp.net页面之间持久化数据的标准方法。但是,你不会想保持会话各地10小时。默认情况下,我相信这是20分钟。

Sessions are the standard method for persisting data between pages in asp.net. However, you are not going to want to keep sessions around for 10 hours. By default, I believe it is 20 minutes.

您可以延长超时,但我会建议存储的cookie或等价的东西。

You can extend the timeout, but I would recommend storing a cookie or something equivalent.

这篇关于ASP.NET简单的用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆