code-tutorial.com

The best resources for developers

How do I upload a request in ASP.NET and redirect it to external domains?

public static void PassthroughAuthentication()
{

    System.Web.HttpContext.Current.Response.Write("<body 
    onload=document.forms[0].submit();window.location="Home.aspx";>");

    System.Web.HttpContext.Current.Response.Write("<form name="Form" 
    target=_blank method=post 
    action="https://external-url.com/security.asp">");

    System.Web.HttpContext.Current.Response.Write(string.Format("<input 
       type=hidden name="cFName" value="{0}">", "Username"));

    System.Web.HttpContext.Current.Response.Write("</form>");
    System.Web.HttpContext.Current.Response.Write("</body>");
}

Tags: javascript c# forms asp.net postback

Source: By saalon as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0


Related code-snippets: