0

Hi, I am new to C# and website design. I am working on a console application that will temporarily create a valid URL and receive the HTTP request for a short time. Can anyone help?

ews2001
  • 2,176
  • 3
  • 26
  • 38
Pang
  • 1
  • 1
  • 1
    [What have you tried?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Kash Sep 05 '12 at 16:46
  • I can't tell if you want to write a client that creates a string like `http://www.stackoverflow.com`, makes a request and captures the response, or a server that will accept a request, e.g. for `ftp://www.mytest.disorg` and do something. For a short time. – HABO Sep 05 '12 at 16:51
  • You could create a simple WCF client, and dynamically host at a temporary endpoint, receive what you need to receive, and shut down/start over. A simple example (replace net.tcp with http) http://weblogs.asp.net/ralfw/archive/2007/04/14/a-truely-simple-example-to-get-started-with-wcf.aspx – Jaime Torres Sep 05 '12 at 16:54

1 Answers1

0

If I understand correct you only need to make a RewritePath to any call. This can be done on global.asax as:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
    // Any call, eg WhatEverName.aspx -> it will call the ExistingFile.aspx
    HttpContext.Current.RewritePath("ExistingFile.aspx");
}
Aristos
  • 66,005
  • 16
  • 114
  • 150