Response.Redirect with POST instead of Get?

后端 未结 14 1236
离开以前
离开以前 2020-11-22 04:04

We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to \"submit\" a form with POST, n

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 04:33

    This should make life much easier. You can simply use Response.RedirectWithData(...) method in your web application easily.

    Imports System.Web
    Imports System.Runtime.CompilerServices
    
    Module WebExtensions
    
         _
        Public Sub RedirectWithData(ByRef aThis As HttpResponse, ByVal aDestination As String, _
                                    ByVal aData As NameValueCollection)
            aThis.Clear()
            Dim sb As StringBuilder = New StringBuilder()
    
            sb.Append("")
            sb.AppendFormat("")
            sb.AppendFormat("
    ", aDestination) For Each key As String In aData sb.AppendFormat("", key, aData(key)) Next sb.Append("
    ") sb.Append("") sb.Append("") aThis.Write(sb.ToString()) aThis.End() End Sub End Module

提交回复
热议问题