Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

I am facing a unqiue issue in which i am creating a application in which i have to redirect through post method to another application and getting back from same appication to our application through post method.

Application platform - ASP.NET 4.5

Thanks & Regards

What I have tried:

I have used normal http post method to pass values from one application to another. but Session created on main application become unavaliable when another application returns back to main application.

Post method is given below:-


Quote:
public string PreparePOSTForm(System.Web.UI.Page myPage, string formID, string url, System.Collections.Hashtable data) // post form
{
//Set a name for the form
//string formID = "PostForm";
//Build the form using the specified data to be posted.
StringBuilder strForm = new StringBuilder();
strForm.Append("");

foreach (System.Collections.DictionaryEntry key in data)
{
strForm.Append("");
}

strForm.Append("");
//Build the JavaScript which will do the Posting operation.
StringBuilder strScript = new StringBuilder();
strScript.Append("");
strScript.Append("var v" + formID + " = document." +
formID + ";");
strScript.Append("v" + formID + ".submit();");
strScript.Append("");
//Return the form and the script concatenated.
//(The order is important, Form then JavaScript)

myPage.Controls.Add(new LiteralControl(strForm.ToString() + strScript.ToString()));

return strForm.ToString() + strScript.ToString();
}
Posted
Updated 6-Apr-20 18:49pm
v2
Comments
F-ES Sitecore 6-Apr-20 9:05am    
How are you doing the redirect?
Gaurav Gupta A Tech Guy 7-Apr-20 0:47am    
Using HttpPost method as per below code:-

public string PreparePOSTForm(System.Web.UI.Page myPage, string formID, string url, System.Collections.Hashtable data) // post form
{
//Set a name for the form
//string formID = "PostForm";
//Build the form using the specified data to be posted.
StringBuilder strForm = new StringBuilder();
strForm.Append("");

foreach (System.Collections.DictionaryEntry key in data)
{
strForm.Append("");
}

strForm.Append("");
//Build the JavaScript which will do the Posting operation.
StringBuilder strScript = new StringBuilder();
strScript.Append("");
strScript.Append("var v" + formID + " = document." +
formID + ";");
strScript.Append("v" + formID + ".submit();");
strScript.Append("");
//Return the form and the script concatenated.
//(The order is important, Form then JavaScript)

myPage.Controls.Add(new LiteralControl(strForm.ToString() + strScript.ToString()));

return strForm.ToString() + strScript.ToString();
}

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