Need to get the HTTP version

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default 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 HttpWorkerRequest which has a method called
    GetHttpVersion() which returns the exact thing I am
    missing. However, I can't see how to get at the
    HttpWorkerRequest from a Page or from the HttpApplication.

    What am I missing?
    Thanks!
    Juan
    Juan Dent Guest

  2. Similar Questions and Discussions

    1. HTTP Version Not Supported
      Hi all! Im new to webservices, so please have patience :) I´m calling a webservice from another company. It´s a simple call looking like this:...
    2. Send Basic HTTP authentication credential in the first HTTP request
      Hello, How can I make the web service proxy class send basic authentication information in the HTTP header of the first request? My...
    3. #19113 [Com]: HTTP status 200 returned on HTTP CONNECT when mod_proxy not in use
      ID: 19113 Comment by: arafuse at bcexplorers dot com Reported By: php_new at jdc dot parodius dot com Status: ...
    4. HTTP::Request failed on HTTP/1.1 and Connection: Keep-Alive
      Hi Abigail, I know that the error comes from the Java program, the nullpointer error. But what it confused me is: if I'm using an Internet Explorer...
    5. Browser, Version and OS from HTTP User Agents?
      Very minor difference in browser versions are having a significant effect on whether Mac users can access some of our web pages. Does anyone know...
  3. #2

    Default 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.ServerVariables.
    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.com>
    | Sender: "Juan Dent" <juan5@dev.com>
    | References: <367901c33ff2$22d29f10$a401280a@phx.gbl>
    <HlnfoTBQDHA.1748@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$30fa0720$a401280a@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: AcNAHDD3hOYTHlkISaumJPMKmwaj9A==
    | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Path: cpmsftngxa09.phx.gbl
    | Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.aspnet:31552
    | NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    | X-Tomcat-NG: microsoft.public.dotnet.framework.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
    | IAuthenticationModule 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.HttpWebRequest rqst =
    | >(HttpWebRequest)System.Net.WebRequest.Create
    | ("http://www.microsoft.com");
    | >rqst.Method = "POST";
    | >rqst.ProtocolVersion = HttpVersion.Version10;//sets the
    | version to 1.0
    | >
    | >In some method you can get the WebRequest from ASP.NET
    | such as Authenticate
    | >of the IAuthenticationModule,
    | >
    | >The following sample illustrates this:
    | >
    | >using System;
    | >using System.Net;
    | >using System.Text;
    | >
    | >namespace MyAuthenticationModule
    | >{
    | > public class MyAuthenticationModule :
    | IAuthenticationModule
    | > {
    | > private string _authType = "Basic";
    | > public Authorization Authenticate(String
    | 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.com>
    | >| Sender: "Juan Dent" <juan5@dev.com>
    | >| Subject: Need to get the HTTP version
    | >| Date: Tue, 1 Jul 2003 09:59:29 -0700
    | >| Lines: 14
    | >| Message-ID: <367901c33ff2$22d29f10$a401280a@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+S9YAxvzvaopQ==
    | >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | >| Newsgroups: microsoft.public.dotnet.framework.aspnet
    | >| Path: cpmsftngxa09.phx.gbl
    | >| Xref: cpmsftngxa09.phx.gbl
    | microsoft.public.dotnet.framework.aspnet:31453
    | >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    | >| X-Tomcat-NG: microsoft.public.dotnet.framework.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 HttpWorkerRequest which has a method called
    | >| GetHttpVersion() which returns the exact thing I am
    | >| missing. However, I can't see how to get at the
    | >| HttpWorkerRequest from a Page or from the
    | HttpApplication.
    | >|
    | >| What am I missing?
    | >| Thanks!
    | >| Juan
    | >|
    | >
    | >
    | >
    | >
    | >.
    | >
    |


    Bassel Tabbara [MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139