SammoSampson
SammoSampson

Reputation: 245

Reading classic asp.net request http headers in c#

Does anyone know how to read all http headers from classic asp request object in c# into a string? My code is this:

ASPTypeLibrary.IRequestDictionary dictionary = request.ServerVariables;
object headers = dictionary["ALL_HTTP"];
return (string)headers;

The last line fails.

Please help! GRR COM!

Upvotes: 1

Views: 701

Answers (1)

SammoSampson
SammoSampson

Reputation: 245

I managed to get the value out by doing the following:

string variableValue = string.Empty;
foreach (string item in ((IEnumerable)request["ALL_HTTP"])) variableValue = item;

Upvotes: 2

Related Questions