哪个函数可以在global.asax页面中获取SessionID? [英] In which function can get SessionID in global.asax page ?

查看:295
本文介绍了哪个函数可以在global.asax页面中获取SessionID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
在哪个函数(Application_Start,Application_End,Application_Error,Session_Start,Application_AcquireRequestState ....等)可以在global.asax页面中获取Session.SessionID,使用

Hi In which function(Application_Start,Application_End,Application_Error,Session_Start,Application_AcquireRequestState....ect) can get Session.SessionID in global.asax page,using

System.Web.HttpContext.Current.Session.SessionID




当web应用程序首先从Global.asax页面开始时,
bcz首先执行,所以在global.asax页面中我将设置一个存储路径,所以我还需要追加sessionid,如果第一次打开网站可以获得sessionid,一旦任何事件发生或网页完全加载在网站上不能获取sessionid,它什么也没有显示错误。



那么在哪个函数中总能得到sessionid?或者如何在VB中的Global.asax页面中的Application_Start函数中完全加载页面时检查sessionid是否有用



注意:编码语言是VB



问候

Aravind



bcz when web application start at first Global.asax page execute first,so in global.asax page i will set one storage path,so i need to append sessionid also,if first time website open can get sessionid,once any event occur or page fully loaded in website cant get sessionid,it nothing and show error.

So in which function can get sessionid always ? or how to check sessionid have or not when page fully loaded in Application_Start function in Global.asax page in VB

Note:Coding Language is VB

Regards
Aravind

推荐答案

C#:

C#:
void Session_Start(object sender, EventArgs e)
{
    string sessionId = System.Web.HttpContext.Current.Session.SessionID;

}





VB:



VB:

Private Sub Session_Start(sender As Object, e As EventArgs)
    Dim sessionId As String = System.Web.HttpContext.Current.Session.SessionID

End Sub


这篇关于哪个函数可以在global.asax页面中获取SessionID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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