Results 1 to 3 of 3

Thread: Obtain Original URL from the Client Request

  1. #1
    Join Date
    Jan 2009
    Posts
    96

    Obtain Original URL from the Client Request

    I'm looking for a solution to get the original send URL from the client request, whenever i received a request from the Client that stored in c:/URL_folder/myfile%30test.txt HTTP/1.5".I tried out to find some more information related to where else these files are stored but i Never found a property or collection item which has the value "/URL_folder/myfile%30test.txt" I expect. But i was successful in finding out the values where the path for "/URL_folder/myfile%30test.txt" is translated in "/folder/myfile test.txt" but I need the quoted URL. Where can I get this?

  2. #2
    Join Date
    Jan 2006
    Posts
    211

    Re: Obtain Original URL from the Client Request

    With the Requst object only, you cannot get the original HTTP request contents, but you can get close. Since there are multiple ways to encode URLs, the following (easy) method might not give the exact original, but if this is OK to you, then you can use the following code.

    The step you need is simply to re-encode the given URL you have, and then
    work with that.

    For example, given a page "/Default Page Test.asxp", the following code:

    --------------------------
    string url = Uri.EscapeUriString(Request.RawUrl);
    --------------------------

    ...would return "/Default%20Page%20Test.aspx".

    Hope this helps!

  3. #3
    Join Date
    Dec 2008
    Posts
    202

    Re: Obtain Original URL from the Client Request

    Hi,

    If you really need the original values, you will have to depend on the
    web server.

    For IIS see http://msdn.microsoft.com/en-us/library/ms524602.aspx

    HTTP_METHOD
    HTTP_URL
    HTTP_VERSION

    Note that you have to use HttpWorkerRequest.GetServerVariable() because
    HttpRequest only enables access to a subset of the server variables.

    To obtain HttpWorkerRequest:

    HttpContext context = ...
    HttpWorkerRequest workerRequest =
    (HttpWorkerRequest)((IServiceProvider)context).GetService(typeof(HttpWorkerRequest));

Similar Threads

  1. Replies: 4
    Last Post: 11-01-2014, 10:14 AM
  2. Replies: 8
    Last Post: 15-11-2011, 10:45 AM
  3. Client doesn't request blocks from peers in uTorrent
    By Sirens in forum Technology & Internet
    Replies: 5
    Last Post: 24-06-2010, 01:21 PM
  4. Replies: 3
    Last Post: 22-10-2009, 08:40 PM
  5. Replies: 3
    Last Post: 10-05-2007, 11:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,788,238.24364 seconds with 16 queries