Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Obtain Original URL from the Client Request

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-03-2009
Member
 
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?

Reply With Quote
  #2  
Old 19-03-2009
Member
 
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!
Reply With Quote
  #3  
Old 19-03-2009
Member
 
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));
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Obtain Original URL from the Client Request"
Thread Thread Starter Forum Replies Last Post
Error parsing Request: The request subject name is invalid or too long. 0x80094001 (-2146877439) Dharitree Windows Security 4 11-01-2014 10:14 AM
Getting error "Your request timed out. Please retry the request." on Opera 11.60 beta Pa!trick Technology & Internet 8 15-11-2011 10:45 AM
Client doesn't request blocks from peers in uTorrent Sirens Technology & Internet 5 24-06-2010 01:21 PM
Error message from Client Setup wizard when new user logs on to client computer Kishan Small Business Server 3 22-10-2009 08:40 PM
Certificate Request Processor - The request contains no cert templ BrianS Windows Server Help 3 10-05-2007 11:12 PM


All times are GMT +5.5. The time now is 04:39 PM.