首页 > 解决方案 > 为什么我的 XML 不使用表单操作 URL 重定向?

问题描述

我希望我的页面将重定向到表单的 action 属性中的 url。但事实并非如此,它只是继续响应。在我的页面上写下 \n 和 \t。我的身体 onload 上有 AutoSubmit 功能。

    Dim xhtmlstr As String
    
    xhtmlstr = "<?xml version='1.0' encoding='UTF-8'?>"
    xhtmlstr += "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
    xhtmlstr += "<html xmlns='http://www.w3.org/1999/xhtml'>\n"
    xhtmlstr += "<head>\n"
    xhtmlstr += "\t<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>\n"
    xhtmlstr += "<title>Sending request....</title>\n"
    xhtmlstr += "<script type='text/javascript' language='JavaScript'>"
    xhtmlstr += "window.history.forward(-1);"
    xhtmlstr += "function AutoSubmitForm() {"
    xhtmlstr += "document.collect.submit();"
    xhtmlstr += "}\n"
    xhtmlstr += "</script>\n"
    xhtmlstr += "</head>\n"
    xhtmlstr += "<body onload='AutoSubmitForm()'>\n"
    xhtmlstr += "<form name='collect' id='collect' action='https://myURL.net/payment/Default.aspx' method='POST'>\n"
    xhtmlstr += "\t<input type='hidden' name='paymentrequest' value='" + createRequest() + "'/>\n"


    xhtmlstr += "</form>\n"
    xhtmlstr += "</body>\n"
    xhtmlstr += "</html>"

   
    Response.ContentType = "text/xml"
    Response.Charset = "UTF-8"

    Response.Clear()
    Response.Write(xhtmlstr)
    Response.End()

标签: asp.netxmlvb.net

解决方案


推荐阅读