简体   繁体   English

MVC中的会话超时警报

[英]Session TimeOut Alert in MVC

Is there a standard approach in prompting users alerts, for a session timeout in ASP.NET MVC? 在ASP.NET MVC中,是否存在用于提醒用户警报以确保会话超时的标准方法? I know we can have client jquery modal windows which can be used for alerting users, and it can be kept in layout or master pages, what if I have more than one master page. 我知道我们可以有可用于提醒用户的客户端jquery模态窗口,并且可以将其保留在布局或母版页中,如果我有多个母版页怎么办。

Not sure if that is the best way to go about it. 不确定这是否是最好的方法。

Any help is appreciated... 任何帮助表示赞赏...

If there is a common layout page that all other layout pages use, then I would place it there. 如果存在所有其他布局页面都使用的通用布局页面,那么我会将其放置在那里。 Otherwise, each layout page will need to include it. 否则,每个布局页面都需要包含它。

Either way, to avoid duplication, you will want to place it in a user control so you can simply include it from where you need it using just a couple of lines of code. 无论哪种方式,为了避免重复,您都希望将其放置在用户控件中,因此您只需使用几行代码就可以在需要的地方简单地添加它。

Well I figured out another way to do it. 好吧,我想出了另一种方法。

The approach I took is to create a jquery file. 我采用的方法是创建一个jquery文件。 Inside it create DHTML and slidertimeout functionality both in it and then put the jquery file in the jquery bundle, in this way I have all my html (or DHTML) and functionality in one file, and its being referred through out the app 在其内部创建DHTML和slidertimeout功能,然后将jquery文件放入jquery包中,这样,我将所有html(或DHT​​ML)和功能都放在一个文件中,并且在整个应用程序中都将其引用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM