Global.asax 에서 RouteTable를 사용하셔 POST 데이터 전송시 에러가 발생하는 경우 사용


using System.Web.Routing;


void Application_Start(object sender, EventArgs e)

{

   // 응용 프로그램이 시작될 때 실행되는 코드입니다.

    RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}");

    RegisterRoutes(RouteTable.Routes);

}


void RegisterRoutes(RouteCollection routes)

{

  routes.MapPageRoute("IndexPage", "Index", "~/Index.aspx");

  //추가

}


트릭 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
void Application_EndRequest(Object Sender, EventArgs e)
{
            if ("POST" == Request.HttpMethod)
            {
                byte[] bytes = Request.BinaryRead(Request.TotalBytes);
                string s = Encoding.UTF8.GetString(bytes);
                if (!String.IsNullOrEmpty(s))
                {
                    int QueryStringLength = 0;
                    if (0 < Request.QueryString.Count)
                    {
                        QueryStringLength = Request.ServerVariables["QUERY_STRING"].Length;
                        Response.AppendToLog("&");
                    }
 
 
                    if (4100 > (QueryStringLength + s.Length))
                    {
                        Response.AppendToLog(s);
                    }
                    else
                    {
                        Response.AppendToLog(s.Substring(0, (4090 - QueryStringLength)));
                        Response.AppendToLog("|||...|||");
                    }
                }
            }
}
cs


+ Recent posts