Add custom server variables with HttpModule

  • Thread starter Thread starter Cybermedia Marketing
  • Start date Start date
C

Cybermedia Marketing

I'm trying to convert an ISAPI filter to an httpmodule. The ISAPI filter
added custom headers to the response which could later be accessed by the
asp page.

ISAPI Filter:

pvPrep->SetHeader(pfc, "Instance-Id:", info->instance_id);
pvPrep->SetHeader(pfc, "Company-Id:", info->company_id);
pvPrep->SetHeader(pfc, "Primary:", info->hostname);
pvPrep->SetHeader(pfc, "Profile:", buffer);

These could then be accessed in asp by calling:

Request.servervariables("HTTP_INSTANCE_ID")
Request.servervariables("HTTP_COMPANY_ID")
Request.servervariables("HTTP_PRIAMRY")
Request.servervariables("HTTP_PROFILE")


I've tried adding headers to the response in my httpmodule with the
following code:

_app.Context.Response.AddHeader("INSTANCE-ID", instance_id)
_app.Context.Response.AddHeader("COMPANY-ID", company_id)
_app.Context.Response.AddHeader("PRIMARY", hostname)

and when I view the headers in a tool like wfetch the headers are there but
they can't be accessed thru the servervariables object in the resulting
page.

BTW, I did setup IIS to use the aspnet_isapi.dll to process asp pages.

Anybody have any thoughts or Ideas on how I can make this work or what I'm
doing wrong?

I can't use viewstate or session variables or anything like that due to the
way the original asp app uses these variables.
 
Cybermedia Marketing said:
I'm trying to convert an ISAPI filter to an httpmodule. The ISAPI filter
added custom headers to the response which could later be accessed by the
asp page.

ISAPI Filter:

pvPrep->SetHeader(pfc, "Instance-Id:", info->instance_id);
pvPrep->SetHeader(pfc, "Company-Id:", info->company_id);
pvPrep->SetHeader(pfc, "Primary:", info->hostname);
pvPrep->SetHeader(pfc, "Profile:", buffer);

These could then be accessed in asp by calling:

Request.servervariables("HTTP_INSTANCE_ID")
Request.servervariables("HTTP_COMPANY_ID")
Request.servervariables("HTTP_PRIAMRY")
Request.servervariables("HTTP_PROFILE")


I've tried adding headers to the response in my httpmodule with the
following code:

_app.Context.Response.AddHeader("INSTANCE-ID", instance_id)
_app.Context.Response.AddHeader("COMPANY-ID", company_id)
_app.Context.Response.AddHeader("PRIMARY", hostname)

and when I view the headers in a tool like wfetch the headers are there but
they can't be accessed thru the servervariables object in the resulting
page.

BTW, I did setup IIS to use the aspnet_isapi.dll to process asp pages.

Anybody have any thoughts or Ideas on how I can make this work or what I'm ....
doing wrong?

I can't use viewstate or session variables or anything like that due to the
way the original asp app uses these variables.

How about using Context.Items?
 
Not sure if I can use context.items since the page that will need to read
them will be a classic asp page.

If there a way to access these from classic asp?
 
Cybermedia Marketing said:
Not sure if I can use context.items since the page that will need to read
them will be a classic asp page.

If there a way to access these from classic asp?

No. Sorry I didn't catch that part.

There are articles around on sharing session state between ASP and ASP.NET.
Maybe those will give you an idea.
 
Back
Top