久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Asp.net System.Web.HttpContext.Current.Session 在 global.asa

Asp.net System.Web.HttpContext.Current.Session null in global.asax(Asp.net System.Web.HttpContext.Current.Session 在 global.asax 中為 null)
本文介紹了Asp.net System.Web.HttpContext.Current.Session 在 global.asax 中為 null的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 global.asax 中為當前線程設置了一個自定義安全主體對象,一切正常,通常沒有問題.

I have a custom security principal object which I set in the global.asax for the current thread and all is well, no problems normally.

但是,我只是通過讓頁面提供圖像來添加動態圖像功能,每當加載該動態圖像頁面時,System.Web.HttpContext.Current.Session 在 global.asax 中為 null,這會阻止我從那時起,將安全主體設置為正常和級聯問題.

However, I'm just adding a dynamic image feature by having a page serve up the image and whenever that dynamic image page is loaded the System.Web.HttpContext.Current.Session is null in global.asax which prevents me from setting the security principal as normal and cascading problems from that point onwards.

通常情況下,global.asax 中的 Session 僅在用戶登錄開始時的會話期間為空一次,之后它始終可用,但有這個例外.

Normally the Session is null in global.asax only once during a session at the start when the user logs in, afterwards it's always available with this single exception.

當瀏覽器遇到原始頁面中的圖像標簽時加載動態圖像頁面,即

The dynamic image page is loaded when the browser comes across an image tage in the original page i.e.

我猜這是瀏覽器請求該頁面而不發送一些憑據這一事實的某些方面?

I'm guessing that this is some aspect of the fact that the browser is requesting that page without sending some credentials with it?

任何幫助將不勝感激.

推薦答案

John,

我假設您正在為處理程序使用 ashx 處理程序.如果是這樣,請確保從 IRequiresSessionState 派生,例如:

I'm assuming you're using an ashx handler for the handler. If so, be sure to derive from IRequiresSessionState for example:

public class Images : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{ }

如果您不使用 ashx,您能描述一下動態圖像頁面的含義嗎?

If you're not using an ashx can you describe what you mean by dynamic image page?

喬希

這篇關于Asp.net System.Web.HttpContext.Current.Session 在 global.asax 中為 null的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Why shouldn#39;t I always use nullable types in C#(為什么我不應該總是在 C# 中使用可空類型)
C# HasValue vs !=null(C# HasValue vs !=null)
C# ADO.NET: nulls and DbNull -- is there more efficient syntax?(C# ADO.NET:空值和 DbNull —— 有沒有更高效的語法?)
How to set null value to int in c#?(如何在c#中將空值設置為int?)
How to handle nulls in LINQ when using Min or Max?(使用 Min 或 Max 時如何處理 LINQ 中的空值?)
Method call if not null in C#(在 C# 中如果不為 null 的方法調用)
主站蜘蛛池模板: 欧美三级免费观看 | 2021天天躁夜夜看 | 亚洲码欧美码一区二区三区 | 久久久久久久久久久成人 | 粉色午夜视频 | 日韩一区二区福利视频 | 亚洲精品一区二区网址 | 视频一区二区在线观看 | aaaa日韩 | 国产精品久久久久久久久污网站 | 宅女噜噜66国产精品观看免费 | av一区二区三区 | 国产精品欧美一区二区三区 | 日韩免费一区二区 | 一级片免费视频 | 91 在线| a久久| av在线天天 | 一区二区三区日韩 | 日韩一区二区三区在线 | 国产精品黄视频 | 色综合久久久久 | 国产一区二区三区久久久久久久久 | av毛片| 99国产在线 | 一区二区在线不卡 | 成人国产在线视频 | 国产中文 | 成人一区二区三区 | 浴室洗澡偷拍一区二区 | 日本人和亚洲人zjzjhd | 成人激情视频 | 日韩一区二区免费视频 | 人人操日日干 | 色播视频在线观看 | 三级成人片 | 欧美成人激情 | 国产一级特黄真人毛片 | 91porn成人精品 | 黄一区二区三区 | 久草免费电影 |