1

I have an html form like:

 <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
    </head>
    <body>
        <form name="mercForm" action="http://someurl.com/" method="post">

            <input type="hidden" name="some_input" value="206">            

            <input type="submit" value="sub" />
        </form>
    </body>
    </html>

When I post this form by clicking submit button, the new window opens with the posted values. But, I want to implement the same form into a MVC Razor page. I habe tried some code but I failed. New window does not open.

@using (Html.BeginForm("http://some url.com/","SomeController", FormMethod.Post, null))
        {               
                <input type="hidden" name="some_input" value="206">                    
                <input type="submit" value="sub" />            
    }

How can I make it work?

1 Answer 1

1

As I know Html.BeginForm does not take 1st argument as some url, it should be some Action name.

If you want to post your form data to some third party web site then just collect the data inside an action directly and process the form post using HttpWebRequest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.