Global.asax事件不会在iis中触发 [英] Global.asax events doesn't fire in iis

查看:99
本文介绍了Global.asax事件不会在iis中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我使用Visual Studio 2012和Windows 8进行开发。当我将我的代码移动到iis时Global.asax方法没有触发。在global.asax的Session_Start方法中,我将我的请求重定向到Login页面。当我从地址栏更改并复制我的网址并首次将其粘贴到新的浏览器窗口时,它会重定向到登录页面,但稍后会打开地址网址中提到的实际页面。

任何人都可以给我任何建议将我的页面重定向到生产服务器的登录页面。

Hi all.,

Iam using Visual Studio 2012 and Windows 8 for development. When iam moving my code to iis Global.asax methods are not firing. In Session_Start method of global.asax I redirect my request to Login page. When I change and copy my url from address bar and paste it on new browser window for the first time it redirects to Login page but later it open the actual page reffered in address url.
Can anyone give me any suggestions to redirect my page to Login page in production server.

推荐答案

Session_Start事件仅在您第一次访问网站时触发,因为您第一次访问该网站时网站开始新的会话。



如果您希望在每个请求上触发事件,您可以使用Application_BeginRequest或Application_AuthenticateRequest事件。



P.S.如果您尝试实现登录机制,可以使用ASP.NET的内置身份验证机制。
The Session_Start event fires only the first time you visit the website, because the first time you visit the website a new Session is started.

If you want an event to fire on each request you can use the Application_BeginRequest or the Application_AuthenticateRequest events.

P.S. If you are trying to implement a login mechanism, you could use the built-in authentication mechanism of ASP.NET.


这篇关于Global.asax事件不会在iis中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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