在c#中读取经典的asp.net请求http头文件

时间:2014-06-10 16:22:12

标签: .net asp-classic com

有没有人知道如何将c#中经典asp请求对象的所有http头读入字符串?我的代码是这样的:

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

最后一行失败。

请帮忙! GRR COM!

1 个答案:

答案 0 :(得分:2)

通过执行以下操作,我设法获得了价值:

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