ASP to redirect to jsp with hidden parameters without form
I have a ASP page where there is a link wh开发者_StackOverflowich is passed to another domain written in JSP. I need to pass a parameter from ASP page to JSP page but it should be hidden from being caught by user. On other side in JSP page I will retrieve the parameter and use it accordingly. How can I achieve this?
You could do a WebRequest in the .NET page to the JSP page, set whatever you need on the server side JSP, then redirect to a JSP URL with the server side state already in place.
// Create a request for the URL.
WebRequest request = WebRequest.Create ("http://www.contoso.com/default.html");
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
// Display the status.
Console.WriteLine (response.StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Cleanup the streams and the response.
reader.Close ();
dataStream.Close ();
response.Close ();
//redirect after
精彩评论