Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Psib3r 70 posts 119 karma points
    Feb 20, 2013 @ 10:15
    Psib3r
    0

    posting the page

    Hi, I am doing some payment processing and need a way to access the page form (the top form), set the action then post it.  At the moment I am trying to use a user control in the page, but unable to change the form action or post from there, is there a way in Razor of doing it?  I was trying this...

     

    @using xsd;
    
    @{
    
        if(Page.IsPostBack == false)
        {
            var mp = DateTime.Now.ToString("yyyyMMDDHHmmss");
            if (Session["OnlinePaymentRef"] != null)
            {
                mp = Session["OnlinePaymentRef"].ToString();
            }
            var filePath = Server.MapPath(string.Format("{0}.txt", mp));
            var methods = new Methods(filePath);
            var pareq = Session["PaReq"].ToString();
            if (methods.Logmessages())
            {
                methods.LogMessage("OnlinePaymentConfirm.aspx.cs", "PaReq", @pareq, filePath);
            }
    
            if (Session["Enrolled"].ToString().ToLower() == "y")
            {
                var url = Session["URL"].ToString();
    
                var termurl = Session["TermUrl"].ToString();
                <input type="hidden" id="URL" name="URL" value="@url" />
                <input type="hidden" id="PaReq" name="PaReq" value="@pareq" />
                <input type="hidden" id="TermUrl" name="TermUrl" value="@termurl"/>
                <input type="hidden" id="MD" name="MD" value="@url"/>
                <input type="hidden" id="PaRes" name="PaRes" />   
    
    
    
            }
            else
            {
                Response.Redirect("/OnlinePaymentResult.aspx", true);
            }
            <script type="text/javascript">
                var url = <%=Session["URL"]%>;
            $('form1').get(0).setAttribute('action', url);
            $(document).ready(function() {$("form1").submit();});
            </script>
        }
    }
Please Sign in or register to post replies

Write your reply to:

Draft