I'm trying to achieve the following:
I want to redirect from one application to another external application and send data through headers. and response should not come it should just redirect.
For eg :
WebApplication 1 :
public ActionResult RedirectPage(string firstName,string lastName)
{
var url = "http://localhost:64603/";
var request = (HttpWebRequest)WebRequest.Create(url);
request.Headers.Add("firstName", firstName);
request.AllowAutoRedirect = false;
var response = (HttpWebResponse)request.GetResponse();
return new RedirectResult(url);
}
Web Application 2 :
public ActionResult Index()
{
if (Request.Headers["firstName"] != null)
{
string ss = Request.Headers["firstName"].ToString();
}
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
return View();
}
So, my requirement is the page should be redirected from WebApplication1 to WebApplication2 and data should be send through headers.