Display the HTTP POST/GET string on the page
-
First off, my apologies for my poor english. I've already looked everywhere to find this piece of info by myself, now I humbly come in seek of help from the gurus on this board - please help this lowly desperate developer :) The million-dollar question is: is it possible to display in a page (with Response.Write() for instance) the original HTTP get/post command the browser used to open it? For example, if I connect to my local server via telnet and issue a "GET /default.aspx" command, I need the page to output this exact command so that the end user can see what was requested. Thanks a lot in advance! Unix is user-friendly. It's just picky about its friends!
-
First off, my apologies for my poor english. I've already looked everywhere to find this piece of info by myself, now I humbly come in seek of help from the gurus on this board - please help this lowly desperate developer :) The million-dollar question is: is it possible to display in a page (with Response.Write() for instance) the original HTTP get/post command the browser used to open it? For example, if I connect to my local server via telnet and issue a "GET /default.aspx" command, I need the page to output this exact command so that the end user can see what was requested. Thanks a lot in advance! Unix is user-friendly. It's just picky about its friends!
-
The
HttpMethod
andRequestType
properties of theRequest
object will tell you what HTTP verb was used to make the request. You can get the request URL by querying theUrl
property of theRequest
object.Paul Marfleet
Thanks for the quick reply on this, but that's not exactly what I'm looking for. Here's what I'm trying to accomplish: When the user reaches the default document on my website (default.aspx), I need to detect whether he used just the domain name (e.g. www.mysite.com) or if he also included the name of the file (e.g. www.mysite.com/default.aspx). I've been digging so deep into this I got bits stuck under my nails, and this is really the only way I could think of accomplishing this task. I am wide open for suggestions though - in fact, they will be much appreciated.
-
Thanks for the quick reply on this, but that's not exactly what I'm looking for. Here's what I'm trying to accomplish: When the user reaches the default document on my website (default.aspx), I need to detect whether he used just the domain name (e.g. www.mysite.com) or if he also included the name of the file (e.g. www.mysite.com/default.aspx). I've been digging so deep into this I got bits stuck under my nails, and this is really the only way I could think of accomplishing this task. I am wide open for suggestions though - in fact, they will be much appreciated.
Try to print
Request.RawUrl
, I guess this will give the URL visible on the address bar.Andre Luiz V Sanches wrote:
I need to detect whether he used just the domain name (e.g. www.mysite.com) or if he also included the name of the file (e.g. www.mysite.com/default.aspx)
This looks strange, why do you want to do this ?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Try to print
Request.RawUrl
, I guess this will give the URL visible on the address bar.Andre Luiz V Sanches wrote:
I need to detect whether he used just the domain name (e.g. www.mysite.com) or if he also included the name of the file (e.g. www.mysite.com/default.aspx)
This looks strange, why do you want to do this ?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
No luck, Request.RawUrl will print out the page name even if the user did not explicitly typed it in.
N a v a n e e t h wrote:
This looks strange, why do you want to do this ?
it's a request from the SEO expert who's working with us. I wonder if there are any low-level IIS API calls I could use from within .NET to capture the exact HTTP command that was sent to the server. Any ideas?