如果用户不是“登录",则直接显示“登录"弹出窗口并在页面加载时隐藏主页 [英] To show a Login popup Directly and Hide the home page on page load if user is not Log-In

查看:99
本文介绍了如果用户不是“登录",则直接显示“登录"弹出窗口并在页面加载时隐藏主页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行一个实时项目,而在一个问题中遇到了一个问题,

主页-要求页面的所有查看者都登录-在灰色主页上显示登录弹出窗口.如果您尚未登录,则您将无法查看任何内容!"

现在,请帮助我弄清楚这个问题
尽快

谢谢,
Jasmeet Singh

I am working on a live Project and i am having a problem in a issue that

"Home Page - Require all viewers of the page to login - show login popup over grayed out home page. If you are not logged in, you should not be able to view anything!"

Now please help me figure out this issue
as soon a s possible

Thanks,
Jasmeet Singh

推荐答案

HI,

请下载Graybox弹出窗口或其他j-Query弹出窗口.

灰盒

当时在page_load事件中加载主页时,您可以检查
用户是否登录(使用用户会话,即Session ["User"]!= null)

如果用户未登录,则将使用JavaScript代码打开此弹出窗口.

HI ,

Please download the Graybox popup or other j-Query for popup window.

Gray Box

When home page is loading at that time in page_load event you can check
User is log in or not (Using User Session i.e. Session["User"] != null )

if User is not log in then you will Open this Pop up window using JavaScript code .

Page.ClientScript.RegisterStartupScript(Page.GetType(), "Popup", "GB_show(caption, your login page, height, width, callback_fn)", true);


通常,开发人员会执行以下操作:

用户登录后,UserId将立即保存在Session中.
在Page_Load事件上,检查会话中的天气UserId是否为null.
如果为空,则重定向到登录页面.

Generally developers do following:

As soon as user is logged-In, UserId is saved in Session.
On Page_Load event check weather UserId in sessions is null or not.
If it is null then redirect to Login Page.

protected void Page_Load(object sender, EventArgs e)
{        
   if (!IsPostBack)
   {
       // Check here for Logged-in userid.
   }
}



如果对您有帮助,请标记为答案.



Mark as answer, if it is helpful to you.


这篇关于如果用户不是“登录",则直接显示“登录"弹出窗口并在页面加载时隐藏主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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