`
lovnet
  • 浏览: 6723344 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

Redirecting the User when the Session Expires

阅读更多

By Rich W.

I am building an intranet site that has different levels of security, and a current problem with the legacy software is that people spend time finding out information that they aren't supposed to have access to. The login security can be a problem if the session timeout is too long, but even then users can come by and see someone's computer screen if they don't close the browser window. I found a fix that automatically asks the users for the login and password if they just leave the browser open. In my include file that contains my login check, (this appears at the top of every asp page that requires the login security.) I added one line. Here is the file contents:

Response.AddHeader "Refresh",CStr(CInt(Session.Timeout + 1) * 60)
Response.AddHeader "cache-control", "private"
Response.AddHeader "Pragma","No-Cache"
Response.Buffer = TRUE
Response.Expires = 0
Response.ExpiresAbsolute = 0

If (Session("Authenticated") <> Session.SessionID) Then
	Session("RequestedURL") = "http://" & _
	    Request.ServerVariables("SERVER_NAME") & _
		Request.ServerVariables("SCRIPT_NAME")

	Temp = Request.ServerVariables("QUERY_STRING")
	If (Not(ISNull(Temp)) AND Temp <> "") Then
		Session("RequestedURL") = Session("RequestedURL") & _
		    "?" & Temp
	End If
	Response.Redirect("/login.asp")
End If

Line 1 addes a refresh tag that refreshes the page exactly 1 minute after the session timed out. This will cause the login page to appear and then redirect the user back to the page they were viewing.

Hope this helps someone,

Happy Programming!

分享到:
评论

相关推荐

    Redirecting Standard Output to a CEdit Control

    A tool's output is written to the Output window, and the user can copy and clear text from this window. Moreover, the output from the tool is displayed as it is being written, instead of all at once ...

    The Art of Assembly Language Programming

    The 80x86 MOV Instruction 4.8 - Some Final Comments on the MOV Instructions &lt;br&gt;4.9 Laboratory Exercises 4.9.1 The UCR Standard Library for 80x86 Assembly Language Programmers 4.9.2 ...

    Microsoft Codeview and Utilities User's Guide

    15.1.4 Terminating the LIB Session 15.2 Performing Library-Management Tasks with LIB 15.2.1 Creating a Library File 15.2.2 Changing a Library File 15.2.3 Adding Library Modules 15.2.4 Deleting Library...

    Login Control

    *Change: Improved user experience: the control will now display instantly when it s dropped on the Web form, no need to first select the Button Type in the Property window. *Change: DLL name ...

    Redirecting Standard Output to a CEdit Control (27KB)

    Redirecting Standard Output to a CEdit Control (27KB)

    APIHookingComplete

    By doing this, the parameters can be modified, the original program can be tricked if you choose to return an error code when really it should be successful, and so on. All of this is done before the...

    synergy跨平台公用鼠标

    Redirecting the mouse and keyboard is as simple as moving the mouse off the edge of your screen Synergy also merges the clipboards of all the systems into one allowing cut and paste between systems ...

    Clever Internet .NET Suite 6.0.26.0

    &lt;br&gt; Fixed Bugs: &lt;br&gt; HTTP Client - problems with changing the request method from POST to GET when redirecting to another location were fixed. Http Client - the ReceiveProgress ...

    Struts2 2.3.16_doc

    It is strongly recommended that if you are redirecting to another action, you use this result rather than the standard redirect result. See examples below for an example of how request parameters ...

    A new design of light illumination scheme for deep tissue photoacoustic imaging

    Collecting the reflected light and redirecting it onto skin surfaces will increase the effective input energy, resulting in an increase of light penetration depth for the same light source....

    C++标准库(第二版)英文版.pdf

    The C++ Standard Library A Tutorial and Reference (2nd Edition)+cppstdlib-code.zip C++标准库(第二版)英文版.pdf 非扫描版+源代码 Prefaceto the SecondEdition xxiii Acknowledgments for the Second...

    Manning.Spring.in.Action.4th.Edition.2014.11.epub

    7.5.1. Redirecting with URL templates 7.5.2. Working with flash attributes 7.6. Summary Chapter 8. Working with Spring Web Flow 8.1. Configuring Web Flow in Spring 8.1.1. Wiring a flow executor 8.1.2....

    .htaccess

    Bad request 错误请求 403 - Forbidden 禁止 500 - Internal Server Error 内部服务器错误 404 - Wrong page 找不到页面 Then, all you need to do is to create a file to display when the error ...

    [Mastering.Node.js(2013.11) 精通Node.js

    Redirecting requests 114 Location 115 Implementing resource caching 116Table of Contents [ iv ] Handling file uploads 118 Putting it all together 120 Summary 121 Chapter 5: Managing Many Simultaneous ...

    Visual C++ 编程资源大全(英文源码 其它)

    in converts the text format (DOS or UNIX) of a file when it is saved in Visual Studio.(39KB)&lt;END&gt;&lt;br&gt;78,devtruecolour.zip Use any colour in the Developer Studio IDE(49KB)&lt;END&gt;&lt;br&gt;79,openvc_demo.zip...

    WordPress 2.7 Cookbook.pdf

    Managing authors and users with the User Manager 12 Getting ready 12 How to do it 13 Deleting users 13 Editing user details 13 How it works 14 Importing and exporting content with the Import and...

    Practical Mod Perl

    Handling the "User Pressed Stop Button" Case Section 6.10. Handling Server Timeout Cases and Working with $SIG{ALRM} Section 6.11. Generating Correct ...

    Python Cookbook, 2nd Edition

    The Implementation of the Book Using the Code from This Book Audience Organization Further Reading Conventions Used in This Book How to Contact Us Safari® Enabled Acknowledgments ...

    sogou_toolchain.tar.gz

    /home/rootroot/sogou/toolchain/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include &lt;sys/poll.h&gt; to &lt;poll.h&gt; [-Wcpp] #warning redirecting incorrect #include &lt;sys/poll.h&gt; to ^ In...

    php_6_fast_and_easy_web_development.pdf

    User Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 MySQL Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 Apache ...

Global site tag (gtag.js) - Google Analytics