Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: 19 Apr 2006 08:04:53 -0700,    group: microsoft.public.platformsdk.internet.server.isapi-dev        back       


ISAPI to add a custom HEADER   
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?
date: 19 Apr 2006 08:04:53 -0700   author:   petergi

Re: ISAPI to add a custom HEADER   
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
date: 19 Apr 2006 08:22:30 -0700   author:   petergi

Re: ISAPI to add a custom HEADER   
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?
>
date: Wed, 19 Apr 2006 15:11:18 -0700   author:   Wade A. Hilmo [MS]

Re: ISAPI to add a custom HEADER   
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?
date: 19 Apr 2006 17:22:49 -0700   author:   petergi

Re: ISAPI to add a custom HEADER   
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?
>
date: Wed, 19 Apr 2006 22:51:11 -0700   author:   Wade A. Hilmo [MS]

Re: ISAPI to add a custom HEADER   
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?
>
date: Thu, 20 Apr 2006 00:43:01 -0700   author:   David Wang [Msft]

Re: ISAPI to add a custom HEADER   
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?
>
date: Thu, 20 Apr 2006 06:19:50 -0700   author:   David Wang [Msft]

Re: ISAPI to add a custom HEADER   
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!
date: 20 Apr 2006 07:11:48 -0700   author:   petergi

Re: ISAPI to add a custom HEADER   
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.
date: 20 Apr 2006 09:43:05 -0700   author:   petergi

Re: ISAPI to add a custom HEADER   
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.
>
date: Thu, 20 Apr 2006 13:26:57 -0700   author:   Wade A. Hilmo [MS]

Re: ISAPI to add a custom HEADER   
Thanks Wade!
date: 20 Apr 2006 18:29:15 -0700   author:   petergi

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us