일부 데이터를 웹 메소드 내부의 양식에 게시하려고합니다. 그리고 그 양식을 외부 URL에 게시하고 싶습니다. 양식을 제출할 때 일부 데이터를 전달해야합니다. 본문에 작성된 양식을 제출하여 주어진 URL로 리디렉션하고 싶습니다.csharp의 webmethod에 양식 데이터 게시
웹 메서드 내에서 URL로 리디렉션 할 수있는 방법은 무엇입니까? 아무도 나를 도울 수 없다 .. 아래 코드는 제 코드입니다.
[webMethod]
public static void RedirectUrl()
{
string pspId = "test";
string orderId="1000";
if (!string.IsNullOrEmpty(Url))
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<html><head>");
HttpContext.Current.Response.Write(
string.Format("</head><body onload=\"document.{0}.submit()\">", "form1"));
HttpContext.Current.Response.Write(
string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", "form1", "Post", Url));
HttpContext.Current.Response.Write(
string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", "PSPID", pspId));
HttpContext.Current.Response.Write(
string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", "orderID", orderId));
HttpContext.Current.Response.Write("</form>");
HttpContext.Current.Response.Write("</body></html>");
HttpContext.Current.Response.End();
}
}`
나는 .I이 코드를하지 않았다 paramyters와 URL로 양식을 제출합니다. –