如何确定用户是否登录非 [英] how to determine whether a user is logged into website of not

查看:78
本文介绍了如何确定用户是否登录非的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的项目中,用户可以发表评论,而我已经完成了,但是我被困在关键时刻.
我希望用户必须先登录网站,然后才能发布任何内容.如果他要发布任何内容,则必须登录.
如何检查用户是否已登录?
如果未登录,则将其定向到登录页面;如果已经登录,则将其定向至他正在使用的页面.该过程如何进行?

请指导.

如果可能的话,请提供一个小例子.

Hi,

In my project a user can comments post articles and I am done with that, but I am stuck at a crucial point.
I would like that a user must be logged in website before he is allowed to post anything. If he wants to post anything he must be logged in.
How to check it whether user is logged in or not?
If he is not logged in then he is directed to login page and if he is already logged in then he is directed to page that he was using. How can this process be carried out?

Please guide.

If possible please provide a small example.

推荐答案

通过维护用户登录详细信息到"会话"中.

请查看以下链接,以获取有关" ASP.NET会话状态概述"的更多信息.
http://msdn.microsoft.com/en-us/library/ms178581.aspx

http://asp.net-tutorials.com/state/sessions/
By maintaining Users login details into "Session".

Have a look at below links for more information on "ASP.NET Session State Overview".
http://msdn.microsoft.com/en-us/library/ms178581.aspx

http://asp.net-tutorials.com/state/sessions/


为了安全登录,您可以使用此

ASP.NET安全 [
For securely login you can use this

ASP.NET Security[^]

-Thanks.


看看这些

在ASP.NET中浏览会话 [检查ASP.NET的成员资格,角色和配置文件 [
Take a look at these

Exploring Session in ASP.NET[^]
Examining ASP.NET''s Membership, Roles, and Profile[^](18 parts)


这篇关于如何确定用户是否登录非的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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