将原始HTTP请求到HttpWebRequest对象原始、对象、HTTP、HttpWebRequest

2023-09-02 20:43:08 作者:你有什么特长

在.NET中是有可能的原始HTTP请求转换为HttpWebRequest对象?

In .NET is it possible to convert a raw HTTP request to HTTPWebRequest object?

我敢肯定,.NET在内部做这件事。任何想法,这在.NET的一部分实际上是处理呢?我可以称之为或者有任何外部库,让原始HTTP连接?

I'm sure .NET internally doing it. Any idea which part of the .NET is actually handling this? Can I call it or is there any external library which allows raw HTTP connections?

推荐答案

我不相信这是一个公开的方法来做到这一点。您可能需要找到或编写一个解析器来打破请求起来,然后写自己的类,它扩展HttpWebRequest的。

I dont believe there is an exposed method to do this. You may have to find or write a parser to break the request up and then write your own class that extends HttpWebRequest.

下面是什么样子从$ C $的CProject解析器:

Here is what looks like a parser from CodeProject:

http://www.$c$cproject.com/KB/IP/CSHTTPServer.aspx

我看着转子code对于HttpWebRequest(暂时的),我没有看到任何脱颖而出银弹。这里是链接到文件:

I looked at the rotor code for the HttpWebRequest (briefly) and I did not see anything that stood out as a silver bullet. Here is the link to the file:

http://www.123aspx.com/Rotor/RotorSrc.aspx?rot=40844

所有的转子code是在这里浏览在线:

All of the rotor code is here for browsing online:

http://www.123aspx.com/Rotor/default.aspx

在这里,你可以下载它:

And here you can download it:

http://www.microsoft.com/downloads/details.aspx?FamilyId=8C09FD61-3F26-4555-AE17-3121B4F51D4D&displaylang=en

我认识了一帮链接并没有真正回答你的问题,但我不认为你正在寻找的框架展示的功能。我很乐意被证明是错误的,所以请更新帖子,如果你觉得这样做的一个很好的方式。我知道工具,有必须这样做,什么都用.NET编写的,它记录的原始请求,然后让你重新提交他们正在做类似的事情。我相信提琴手( http://www.fiddler2.com )写在.NET中,你可能想通过拍一封电子邮件给那些家伙,看看他们是否可以提供帮助。

I know a bunch of links doesn't really answer your question, but I don't think the functionality that you are looking for is exposed in the framework. I would love to be proven wrong, so please update the post if you find a good way of doing it. I know tools out there must do it, anything written in .Net that logs raw requests and then lets you resubmit them is doing something similar. I believe fiddler (http://www.fiddler2.com) is written in .Net, you may want to shoot an email over to those guys and see if they can help.