会话登录页面 [英] login page with session

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

问题描述

我想用两个按钮登录"和注销"创建登录页面
我也想使用会话.请帮助我,并告诉我创建该页面的正确和随笔的方式.我会很感激的....

i want to create a login page with two button "Log In" and "log out"
and i want to use session also. please help me and tell me the right and essay way to create this page . i will be thank full....

推荐答案

首先,为什么?如果他已登录,则只需要一个注销"按钮.如果他没有登录,就无法注销...

其次,是时候开始阅读:演练:创建具有成员资格和用户登录名的网站 [ ^ ]并不复杂,但是这不像按一下页面上的按钮然后走开一样简单! :laugh:
Firstly, why? If he is logged in, he only needs a "Log out" button. If he isn''t logged in, he can''t log out...

Secondly, time to start reading: Walkthrough: Creating a Web Site with Membership and User Login[^] It''s not complicated, but it''s not as simple as chucking a button on a page and walking away! :laugh:


Faiz
使用登录页面上的登录"按钮,然后将退出"按钮放在母版页上.
从基本页面派生所有已登录"页面,并检查页面init上的会话变量,然后将用户重定向到登录页面,例如say
Faiz
Use the "login" button on a login page and put the "logout" button on a master page.
Derive all your "logged in" pages from a base page and check a session variable on page init and redirect the user to a login page, like say
if (Session["IsLoggedIn"] != null && Session["IsLoggedIn"].ToString() != "Y")
         Response.Redirect("~/MyLoginPage.aspx");


但是请确保不要从仅为登录页面创建的基础页面派生MyLoginPage.

在母版页中,根据IsLoggedIn Session变量使注销"按钮可见或不可见.

希望这会有所帮助.


But make sure that you do not derive the MyLoginPage from the base page created only for logged in pages.

In master page make the "logout" button visible or invisible based on the IsLoggedIn Session variable.

Hope this helps.


这篇关于会话登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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