Need to get the HTTP version

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Juan Dent

    Need to get the HTTP version

    Hi,

    The Request.SaveAs method stores in a file the complete
    HTTP request including the HttpVersion. However when I try
    to reproduce in memory the same thing, I cannot find
    the "HTTP/1.1" anywhere. I looked around and found a class
    called HttpWorkerReque st which has a method called
    GetHttpVersion( ) which returns the exact thing I am
    missing. However, I can't see how to get at the
    HttpWorkerReque st from a Page or from the HttpApplication .

    What am I missing?
    Thanks!
    Juan
  • Bassel Tabbara [MSFT]

    #2
    RE: Need to get the HTTP version

    Hello Juan,
    After some research, I found the property that you need to look at. It is
    part of HttpRequest.Ser verVariables.
    From that collection, look at SERVER_PROTOCOL property. This will give you
    the HTTP version.
    If you turn trace on the aspx page, you will see this property part of the
    Server Variables.

    Please let me know if you have more questions on this.

    Thanks,
    Bassel Tabbara
    Microsoft, ASP.NET

    This posting is provided "AS IS", with no warranties, and confers no rights.


    --------------------
    | Content-Class: urn:content-classes:message
    | From: "Juan Dent" <juan5@dev.co m>
    | Sender: "Juan Dent" <juan5@dev.co m>
    | References: <367901c33ff2$2 2d29f10$a401280 a@phx.gbl>
    <HlnfoTBQDHA.17 48@cpmsftngxa09 .phx.gbl>
    | Subject: RE: Need to get the HTTP version
    | Date: Tue, 1 Jul 2003 15:00:32 -0700
    | Lines: 122
    | Message-ID: <39ad01c3401c$3 0fa0720$a401280 a@phx.gbl>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | charset="iso-8859-1"
    | Content-Transfer-Encoding: 7bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | Thread-Index: AcNAHDD3hOYTHlk ISaumJPMKmwaj9A ==
    | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
    | Path: cpmsftngxa09.ph x.gbl
    | Xref: cpmsftngxa09.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:3155 2
    | NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
    |
    | Thanks for your answer.
    | The doubt still remains though, you say:
    |
    | >You can't get the WebRequest from the Page Class, but you
    | >can get the Request object which doesn't have the
    | >property that you need.
    | So what good is it to me to get the Request object, since
    | it does not have a reference to the WebRequest?
    | Do I need to add a class implementing the
    | IAuthentication Module interface just so I can access
    | WebRequest? Seems a lot of work to access something that
    | should be easily accessible.
    |
    | Am I reading you incorrectly?
    | Thanks again,
    | Juan
    |
    |
    | >-----Original Message-----
    | >Hello Juan,
    | >You have to use HttpWebRequest. ProtocolVersion Property.
    | This property gets
    | >or sets the version of HTTP to use for the request.
    | >The following sample use the HttpWebRequest and the
    | version of HTTP:
    | >
    | >System.Net.Htt pWebRequest rqst =
    | >(HttpWebReques t)System.Net.We bRequest.Create
    | ("http://www.microsoft.c om");
    | >rqst.Method = "POST";
    | >rqst.ProtocolV ersion = HttpVersion.Ver sion10;//sets the
    | version to 1.0
    | >
    | >In some method you can get the WebRequest from ASP.NET
    | such as Authenticate
    | >of the IAuthentication Module,
    | >
    | >The following sample illustrates this:
    | >
    | >using System;
    | >using System.Net;
    | >using System.Text;
    | >
    | >namespace MyAuthenticatio nModule
    | >{
    | > public class MyAuthenticatio nModule :
    | IAuthentication Module
    | > {
    | > private string _authType = "Basic";
    | > public Authorization Authenticate(St ring
    | challenge, WebRequest
    | >request, ICredentials credentials)
    | > {
    | > HttpWebRequest httpWebRequest = request as
    | HttpWebRequest;
    | > //...
    | > }
    | > }
    | >}
    | >
    | >You can't get the WebRequest from the Page Class, but you
    | can get the
    | >Request object which doesn't have the property that
    | >you need.
    | >
    | >Does this answer your question?
    | >
    | >
    | >
    | >Thanks,
    | >Bassel Tabbara
    | >Microsoft, ASP.NET
    | >
    | >This posting is provided "AS IS", with no warranties, and
    | confers no rights.
    | >
    | >--------------------
    | >| Content-Class: urn:content-classes:message
    | >| From: "Juan Dent" <juan5@dev.co m>
    | >| Sender: "Juan Dent" <juan5@dev.co m>
    | >| Subject: Need to get the HTTP version
    | >| Date: Tue, 1 Jul 2003 09:59:29 -0700
    | >| Lines: 14
    | >| Message-ID: <367901c33ff2$2 2d29f10$a401280 a@phx.gbl>
    | >| MIME-Version: 1.0
    | >| Content-Type: text/plain;
    | >| charset="iso-8859-1"
    | >| Content-Transfer-Encoding: 7bit
    | >| X-Newsreader: Microsoft CDO for Windows 2000
    | >| Thread-Index: AcM/8iLS2I/EFPTaT+S9YAxvzv aopQ==
    | >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
    | >| Path: cpmsftngxa09.ph x.gbl
    | >| Xref: cpmsftngxa09.ph x.gbl
    | microsoft.publi c.dotnet.framew ork.aspnet:3145 3
    | >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    | >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
    | >|
    | >| Hi,
    | >|
    | >| The Request.SaveAs method stores in a file the complete
    | >| HTTP request including the HttpVersion. However when I
    | try
    | >| to reproduce in memory the same thing, I cannot find
    | >| the "HTTP/1.1" anywhere. I looked around and found a
    | class
    | >| called HttpWorkerReque st which has a method called
    | >| GetHttpVersion( ) which returns the exact thing I am
    | >| missing. However, I can't see how to get at the
    | >| HttpWorkerReque st from a Page or from the
    | HttpApplication .
    | >|
    | >| What am I missing?
    | >| Thanks!
    | >| Juan
    | >|
    | >
    | >
    | >
    | >
    | >.
    | >
    |


    Comment

    Working...