开发者

Reading incoming Headers on aspx page code behind

There is a process that will send an http post request to a specific url, and from there I need to read information stored in the request headers (specifically X-RIM-Push-ID and X-RIM-Push-Status)

Is it possible to read the headers using IIS 6?

I'm planning on using:

var id = Response.Head开发者_StackOverflow中文版ers["X-RIM-Push-ID"];


If you are looking for request headers in ASP.NET:

var id = Request.Headers["X-RIM-Push-ID"];

Is it possible to read the headers using IIS 6?

Hmm, usually it's your application that should read headers, not sure what you mean here.


I believe you need IIS7 running in pipeline mode. See this msdn article. See this msdn article

Enjoy!


We can use reflection and can be read the response headers

        try
        {
            var header = HttpContext.Current.Response;

            header.AppendHeader("test0", "1");
            header.AppendHeader("test1", "2");
            header.AppendHeader("test2", "2");
            header.AppendHeader("test3", "3");
            header.AppendHeader("test4", "4");


            MethodInfo dynMethod = header.GetType().GetMethod("GenerateResponseHeaders", BindingFlags.NonPublic | BindingFlags.Instance);
            var result =  dynMethod.Invoke(header, new object[] { false });
        }
        catch (HttpRequestValidationException ex)
        {
            string str = ex.Message;
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜