Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to Redirect from application one hosted on one server to another application hosted on another server.When I redirect to 2nd server at that time how I get information of Get Request From which sever it comes.

I tried following module code.
public class NewModule:IHttpModule
{

private const string OriginalUrlKey = "CharlieFriendlyUrlModuleRecordOriginalUrl";


//// Record the original, friendly URL. This value is used later in the Pipeline.
private void BeginRequest(object sender, EventArgs e)
{
HttpContext context = ((HttpApplication)sender).Context;


string originalUrl = string.Empty; // code to get original URL from HttpContext.Current.Request
originalUrl = context.Items[OriginalUrlKey].ToString();
}



private HttpApplication _application = null;
string path, schme, applicationpath;
public void Dispose()
{
}

public void Init(System.Web.HttpApplication context)
{
// save the context
_application = context;

// handle the end request
context.EndRequest += new EventHandler(context_EndRequest);
}


// tag a message at the end of the page
void context_EndRequest(object sender, EventArgs e)
{
string message = string.Format("Generated at {0}",
System.DateTime.Now.ToString());
// stream it at the end of the response
_application.Context.Response.Write(message);
}
}
Posted

1 solution

Here is the great tutorial.Check that

HTTP Handlers and HTTP Modules Overview

I hope this will help to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900