如果我們使用Visual Studio 2008的檔案系統的ASP.NET專案時,時常會把共用程式寫在App_code下的類別中,但是一旦我們想在app_code中的class去存取ASP.NET的session或application,cache等物件時會找不到該物件,此時我們可以使用HttpContext.Current取得目前Http Request參考,就可以在App_code取得ASP.NET下的 Session, Application, Request, Response, Cache等常用物件了,例如以下範例:
1: Public Class Class1
2: Dim session As HttpSessionState = HttpContext.Current.Session
3: Public Sub AddSession(ByVal key As String, ByVal value As Object)
4: session(key) = value
5: End Sub
6:
7: Public Function ReadSession(ByVal key As String) As Object
8: Return session(key)
9: End Function
10: End Class
Slots - Dr.MCD
回覆刪除Play Slots at Dr.MCD! We dafabet offer 의정부 출장마사지 over 100000 of the 여주 출장안마 hottest slots and table games to play 양주 출장안마 for free, whether you're in Las Vegas or in 영천 출장샵 Atlantic City.