我遇到问题,让IIS通过Global.ashx.cs Application_Error传递HttpException。以下是复制问题的测试项目示例:
SECTION .data
format: db "%c",0
SECTION .bss
buff: resb 1
SECTION .text
extern printf
extern scanf
global main
main:
loop1:
push buff ;buff will hold the characters in the string/file
push format ;expect character for every buff
call scanf
add esp, 8 ;clear stack
cmp eax, 0 ;if eax is equal to 0 then EOF
je lpend1 ;jump to end main func
xor eax, eax ;clear eax
mov eax, buff ;mov buff to eax register
push eax ;push eax onto the stack
mov eax, format ;mov the string format to eax
push eax ;push onto the stack
call printf ;call printf, prints to screen
add esp, 8 ;clear the stack
jmp loop1 ;jump back to top and repeat
lpend1:
ret ;end of main
您可以使用以上代码在此位置查看应该是自定义404页面的测试网址:
http://www.the2016vote.us/nonsense-page
我没有收到“全局页面错误”。我该如何解决这个问题?
这是我的Web.config:
using System;
using System.Web;
namespace Weber
{
public class Global : HttpApplication
{
protected void Application_Error(object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
Response.Write("<html><body><h2>Global Page Error</h2>");
Response.Write("<p>" + exc.Message + "</p></body></html>");
Server.ClearError();
}
}
}