public void RedirectWithData(NameValueCollection data, string url)
{
Response.Clear();
Response.Buffer = true;
StringBuilder s = new StringBuilder();
s.Append("<html>");
s.Append("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head>");
s.AppendFormat("<body onload='document.forms[0].submit()'>");
s.AppendFormat("<form name='form' action='{0}' method='POST'>", url);
foreach (string key in data)
{
s.AppendFormat("<input type='hidden' name='{0}' value='{1}' />", key, data[key].Trim());
}
s.Append("</form></body></html>");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("euc-kr");
Response.Write(s.ToString());
Response.Flush();
Response.End();
}
NameValueCollection tags = new NameValueCollection();
tags.Add("param1", "value1");
tags.Add("param2", "value2");
tags.Add("param3", "value3");
RedirectWithData(tags, "../test/test.aspx");
댓글 없음:
댓글 쓰기