Asp.net Response.Redirect with post data

时间:2021-09-17 14:26:47
            string url = String.Format("{0}://{1}/{2}", Request.Url.Scheme, Request.Url.Authority, "Default.aspx");

            Response.Clear();
var sb = new System.Text.StringBuilder();
sb.Append("<html>");
sb.AppendFormat("<body onload='document.forms[0].submit()'>");
sb.AppendFormat("<form action='{0}' method='post'>", url);
sb.AppendFormat("<input type='hidden' name='id' value='{0}'>", id);
sb.AppendFormat("<input type='hidden' name='year' value='{0}'>", year);
sb.AppendFormat("<input type='hidden' name='mid' value='{0}'>", mid);
sb.Append("</form>");
sb.Append("</body>");
sb.Append("</html>");
Response.Write(sb.ToString());
Response.End();