之前寫了httpmodule ,後來發現項目中的水晶報表圖表不顯示了。
public void Init(HttpApplication context)
{
context.AcquireRequestState += new EventHandler(context_AcquireRequestState);
}
#endregion
void context_AcquireRequestState(object sender, EventArgs e)
{
// 擷取應用程式
HttpApplication application = (HttpApplication)sender;
string url = application.Context.Request.Path;
string type = url.Substring(url.LastIndexOf('.'));
if (type.ToLower() == ".aspx" && url!="/CrystalImageHandler.aspx")
{
//執行操作~~
說名,右擊無法顯示的表徵圖,發現是個png圖片,地址放到url,發現錯誤:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 39: // 檢查使用者是否已經登入Line 40: Line 41: if (application.Context.Session["loginusername"] == null)Line 42: {Line 43:
|
發現是之前的模組寫的方法session判斷
經調試,發現當水晶報表會把表徵圖以/CrystalImageHandler.aspx" 顯示到瀏覽器,然而這個頁面不知道為什麼不能檢測出session
導致該頁面無法顯示!