RemotePost¶
RemotePost is a utility class that performs a server-side HTTP POST redirect from an ASP.NET web application to a target URL. It accumulates name/value pairs as hidden form fields, then emits a minimal auto-submitting HTML page that causes the browser to POST those fields to the configured destination, bypassing the GET-only limitation of a standard HTTP redirect.
Purpose¶
- Accumulate caller-supplied name/value pairs to be emitted as hidden HTML
<input>fields. - Emit an auto-submitting HTML form targeting a configurable URL via
Post(). - Clear and terminate the current ASP.NET response after emitting the redirect page.
Context¶
- Namespace:
SAIF.Services.Web - Assembly/package:
SAIF.Services.Web(distributed as NuGet packageSAIF.BOF.Services.Web)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
AddInput |
Sub AddInput(Name As String, Value As String) |
Adds a name/value pair to the internal NameValueCollection (m_Inputs) to be rendered as a hidden <input> field in the generated form. |
URL |
Property URL As String |
Gets or sets the target URL the generated <form> will POST to (the form action attribute). |
FormName |
Property FormName As String |
Gets or sets the HTML name attribute of the generated form and the JavaScript document.<FormName>.submit() call; defaults to "form1". |
Post |
Sub Post() |
Clears HttpContext.Current.Response, writes a minimal HTML document containing an auto-submitting <form> with one hidden <input> per added input pair, then calls Response.End() to terminate the response. |
Behavioral notes¶
Post()operates exclusively againstHttpContext.Current; if called outside an active ASP.NET web request context, aNullReferenceExceptionwill occur at runtime.*- Caller-supplied
Name/Valuepairs are written directly into HTML<input>attribute values viaString.Formatwith no HTML-encoding applied; values containing HTML special characters may produce malformed markup or enable injection if untrusted input is passed.* - The internal field
m_Inputsis aSystem.Collections.Specialized.NameValueCollectionused to accumulate all added pairs beforePost()emits the form. - Despite the project declaring an extensive NuGet dependency graph (
SAIF.BOF.Framework,SAIF.Web.API.Clients,Oracle.ManagedDataAccess,RestSharp,Newtonsoft.Json), none of these are referenced by this class — the only runtime dependencies areSystem.Web.HttpContextandSystem.Collections.Specialized.NameValueCollection.*
Constraints and usage notes¶
- Must be called from within an active ASP.NET web request (requires a non-null
HttpContext.Current). URLshould be set before callingPost(); an unsetURLresults in an emptyactionattribute, causing the browser to POST back to the current page.FormNamedefaults to"form1"and may be left at its default unless the calling page already uses that name for another form element.Post()terminates the ASP.NET response viaResponse.End(); no further server-side processing occurs after this call.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Services\SAIF.Services.Web\RemotePost.vbServices\SAIF.Services.Web\SAIF.BOF.Services.Web.vbproj