开发者

How to use IIS to set request header

Hi I have this piece of code in global.asax

public void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
     .
     .
     .
     string domain = Context.HttpContext.Request.Headers[Key];
     .
     .
     .
}

I was told that I need to use IIS to set this header in order to test this. When this code rolls out live the header will automatically get populated by a intermediate server(not important). How do I use IIS to 开发者_开发问答set the request header? The closest I've read up on is this. Thank you


It's just a setting in IIS. The instructions will vary based on the version of IIS you are using.

This is based on the assumption you want to include an out going header to be consumed by another app. It allows you test a response header without redeploying your app and doing it through code.

If you want to test a request header that you can read in your code, then use something like fiddler or a firefox plugin. This allows you to append headers when you make requests to your .NET application.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜