Member
Posts: 3
Registered: ‎05-27-2011
Trouble getting started with SIM in an ASP.Net MVC project

Hi all,

I'm testing the waters with integration in a simple MVC project while I wait for my accounting team to finish our account authorization.

 

Unfortunately, I'm having trouble getting the compiled page to output the correct HTML.  I basically copy/pasted the sample code from

https://developer.authorize.net/integration/fifteenminutes/csharp#hosted , then modified it to build with my project.  The only difference from the sample is that I'm using Razor markup. The page looks like this:

 

@{
    ViewBag.Title = "First Test";
}
 
<h1>@ViewData["message"]</h1>
 
@using (Html.BeginSIMForm("http://YOURSERVER.com/home/sim", 1.99M, "YOUR_API_LOGIN_ID",
    "YOUR_TRANSACTION_KEY"true))
{
   @Html.Raw(Html.CheckoutFormInputs(true));
 
   @Html.Hidden("order_id","1234");
                                  
   <input type = "submit" value = "Pay" />
}


This looks like it should be all fine and dandy, but the problem seems to be with the "BeginSIMForm" helper: the <form>...</form> block gets output before everything else on the page, so when looking at the html on the rendered page, I see the form block up top, then the DOCTYPE, html, head, body, etc.

 

I tried replacing BeginSIMForm with just a basic BeginForm, and if I do that, the form is rendered in the body of the page, as one would expect.

 

Is there something special I need to do to get this to work, or will the HtmlHelpers just not work with MVC3/Razor markup?  If not, that might be something worth documenting somewhere (or at least, that they only work with ASP markup).

 

I appreciate any feedback I might get on this.

 

 

Who Me Too'd this topic