I am new to Authorize.NET and am attempting DPM, ASP.NET MVC3, C#.
When compiling my solution, I get two errors that underscore AuthorizeNET in two places in HomeController.cs, and is telling me that I am missing a directive or refererence for the namespace AuthorizeNet. The AuthorizeNET.DLL reference is created and the web.config is configured with the AuthorizeNET.helpers namespace.
HERE IS THE CODE THAT FAILS, highlighted in bright red, first and last lines in the braces:
[
AcceptVerbs(HttpVerbs.Post)]
publicActionResult Sim(FormCollection post)
{
var response = new AuthorizeNET.SIMResponse(post);
//first order of business - validate that it was Auth.net that posted this using
//the MD5 hash that was passed back to us
var isValid = response.Validate("", "6343LUe4Q9jf");
//if it's not valid - just send them to the home page. Don't throw - that's how
//hackers figure out what's wrong :)
if (!isValid)
return Redirect("http://www.avtec.edu");
//the URL to redirect to- this MUST be absolute
var returnUrl = "http://secure.avtec.edu/?m=" + response.Message;
return
Content(AuthorizeNET.Helpers.CheckoutFormBuilders.Redirecter(returnUrl));
}
Solved! Go to Solution.
01-03-2012 01:25 PM
It a typo, AuthorizeNet
var response = new AuthorizeNET.SIMResponse(post);
is lower case "et" as in AuthorizeNet.SIMResponse(post);
01-04-2012 04:35 AM
Did you move the dll from the reference location?
01-03-2012 01:44 PM
I did not.
If I do remove it, I get all kinds of errors. Those errors resolve when I add it, EXCEPT for these two in question.
Also, is there a difference between the dll found in the bin folder vs. the obj folder? I tried both, but just asking.
01-03-2012 03:00 PM - edited 01-03-2012 03:06 PM
did it have the
using AuthorizeNet;
Not sure about obj folder but I always use the one in bin folder.
01-03-2012 04:07 PM
yep, included that and for kicks added the other classes available, so there are three.
using AuthorizeNet;
using AuthorizeNet.APICore;
using AuthorizeNet.Helpers;
I doubt it is necessary, but it shoudln't do any harm either. ????
And, yes I too am using the .dll from the bin folder.
01-03-2012 05:39 PM - edited 01-03-2012 05:46 PM
Not sure what else to check.
01-03-2012 05:49 PM
It a typo, AuthorizeNet
var response = new AuthorizeNET.SIMResponse(post);
is lower case "et" as in AuthorizeNet.SIMResponse(post);
01-04-2012 04:35 AM
AAAAAHAAAAAAA!!!!!
Thanks Raynor. This was not my typo, but a typo in the Quick Start Guide from where I copied the code.
See: https://developer.authorize.net/integration/fifteenminutes/csharp
:smileylol:
You have been a big help!
01-04-2012 10:15 AM
Raynor,
I have contacted Authorize.net support and alerted them to the typo. I gave you the credit for discovering it.
:smileyhappy:
01-04-2012 10:40 AM - edited 01-04-2012 10:41 AM
Hi,
Thank you for this information, we will make sure to get this updated.
Thanks,
Joy
01-06-2012 03:25 PM