Hello All, I am new at ISAPI filters. What I need to do is add my own custome header to IIS, such as F00 and give it a value of BAR. I then want to be able to access that header through ASP scripting as in : Request.ServerVariables("FOO") Is this even possible? I have kind of managed to add FOO using SetHeader in onPreProcessHeaders but I can't retrieve the value in the way listed above. It will however appear when I list the ALL_HTTP or ALL_RAW headers through ASP. Unfortunately that doesn't help me much because I don't want to parse through all of that trying to find if it's there. Any ideas?
I case you're wondering WHY? It's just to simulate the behaviour of products such as SITEMINDER. It's only for testing purposes. I know it's useless to put in headers whose values I already know. But the point is the code will need to check for the presence of that header and make sure it has a value. Eventually the application will be wired up to siteminder. I
Hi Peter, If you can see the header using ALL_RAW or ALL_HTTP, then you've added it correctly in your filter. When you call Request.ServerVariables, try using "HTTP_FOO" instead of "FOO" and you should get it that way. Thank you, -Wade A. Hilmo, -Microsoft "petergi" wrote in message news:1145459093.869229.225560@i39g2000cwa.googlegroups.com... > Hello All, > > I am new at ISAPI filters. What I need to do is add my own custome > header to IIS, > such as F00 and give it a value of BAR. > > I then want to be able to access that header through ASP scripting as > in : > > Request.ServerVariables("FOO") > > Is this even possible? I have kind of managed to add FOO using > SetHeader in onPreProcessHeaders but I can't retrieve the value in the > way listed above. > It will however appear when I list the ALL_HTTP or ALL_RAW headers > through ASP. > Unfortunately that doesn't help me much because I don't want to parse > through all of that trying to find if it's there. > > > Any ideas? >
Hello Wade, I've tried that as well. When I try to list out HTTP_FOO I just get a blank. Even though I can see it has a value when I look at ALL_HTTP and ALL_RAW. Any ideas?
Hmmm. It should work. The only other thing I can think of is to write an ISAPI extension and use GetServerVariable with "HTTP_FOO". If that works, then the problem has to be somewhere within ASP itself. At that point, I don't have any other suggestion (I know a bit about the ASP internals, but almost nothing about actually using it.) There are lots of folks on microsoft.public.inetserver.iis that use ASP. Someone there might have an idea about getting request headers within ASP. If the ISAPI extension can't get the header, then it'd be interesting to see the exact byte-for-byte value for ALL_RAW and ALL_HTTP to see if there is something strange there. Thank you, -Wade A. Hilmo, -Microsoft "petergi" wrote in message news:1145492569.607413.270900@i40g2000cwc.googlegroups.com... > Hello Wade, > > I've tried that as well. When I try to list out HTTP_FOO I just get a > blank. > Even though I can see it has a value when I look at ALL_HTTP and > ALL_RAW. > > Any ideas? >
If your cookie name has a '_' (underscore) it will not be retrievable via HTTP_ prefix. This is a well known limitation in CGI convention. http://blogs.msdn.com/david.wang/archive/2005/08/18/ISAPI_GetServerVariable.aspx On IIS6 you can use the HEADER_ syntax to retrieve it. See the blog entry and its referenced link to IIS Documentation on MSDN for details. -- //David IIS http://blogs.msdn.com/David.Wang This posting is provided "AS IS" with no warranties, and confers no rights. // "petergi" wrote in message news:1145492569.607413.270900@i40g2000cwc.googlegroups.com... > Hello Wade, > > I've tried that as well. When I try to list out HTTP_FOO I just get a > blank. > Even though I can see it has a value when I look at ALL_HTTP and > ALL_RAW. > > Any ideas? >
http://blogs.msdn.com/david.wang/archive/2006/04/20/HOWTO_Retrieve_Request_Headers_using_ISAPI_ASP_and_ASP_Net.aspx -- //David IIS http://blogs.msdn.com/David.Wang This posting is provided "AS IS" with no warranties, and confers no rights. // "petergi" wrote in message news:1145492569.607413.270900@i40g2000cwc.googlegroups.com... > Hello Wade, > > I've tried that as well. When I try to list out HTTP_FOO I just get a > blank. > Even though I can see it has a value when I look at ALL_HTTP and > ALL_RAW. > > Any ideas? >
Thanks for the posting David. Especially the exhaustive one on your blog. Now I know more than I ever wanted to on the subject. :-) Although I am nut running IIS 6.0 (i am still on 5.1) I will give it a run and see what happens. Cheers!
David Wang is the man. I managed to retrieve it by changing the name and then referencing it as HTTP_ in other words I set SMUSER instead of SM_USER and then retrieved HTTP_SMUSER instead of HTTP_SM_USER. I am not 100% sure as to why the naming matters, but I will re-read your blog posting a couple of times until it all sinks in. Cheers, P.
Hi Peter, It matters because IIS looks up the header by stripping the "HTTP_" and converting any remaining underscores to dashes. If you name your server variable SM-USER instead of SM_USER, then you can retrieve it by calling GetServerVariable on HTTP_SM_USER. Thank you, -Wade A. Hilmo, -Microsoft PS: The more detail you can provide in your questions, the better. If your original posting actually gave SM_USER as the header name instead of FOO, you would have got the correct answer right away :) "petergi" wrote in message news:1145551385.449606.210220@t31g2000cwb.googlegroups.com... > David Wang is the man. > > I managed to retrieve it by changing the name and then referencing it > as HTTP_ > in other words I set SMUSER instead of SM_USER and then retrieved > HTTP_SMUSER instead of HTTP_SM_USER. > > I am not 100% sure as to why the naming matters, but I will re-read > your blog posting a couple of times until it all sinks in. > > Cheers, > P. >
Thanks Wade!