1


I am trying to implement First Data Payment Gateway in my asp.net website.

I have done all things, now I can redirect to https://checkout.globalgatewaye4.firstdata.com/payment and Payment is done but then FirstData is redirecting to my site on Result.aspx page.

On that page how can I know that payment is done successfully or any error occurred etc. I know that it send response code in POST method but when come to my webpage it gives error like :

Server Error in '/' Application.

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.



Any help ...

Thanks in advance..

Sachin
  • 2,152
  • 1
  • 21
  • 43

2 Answers2

0

My friends and I call this the ViewState error of death. Basically this error could be cause by a huge variety of things.

Just in case you actually do need to tend to your machine key settings. I'd go through the following list first:

1) check your web.config file and make sure that your machine key is not set to AutoGenerate.

2) If you're not using auto generate, go into IIS and generate a key, and stick it in your web.config to see if that temporarily fixes the problem. (this is not a good long term solution, but it could help you continue to make progress while you work on a long term solution simultaneously).

3) Finally and in any case, go through the controls you're using, and see if they use view state. If they do, try disabling it for all your controls. IF that fixes it, then there's some sort of error when your app tries to de-serialize the viewstate data. I've found this to be a problem when trying to load a page from a separate website, which is similar to what you're doing.

If you find that disabling viewstate solves your problem, I'm not sure of a good workaround, if you need to continue using viewstate.

Scott Terry
  • 1,223
  • 1
  • 14
  • 20
0

I want to share what I have done but other suggestions will be appreciated.. :

I have got such error and I can't even go to Page_Load Event.
So I have just create one new page and redirect to that page in the Page_Init Event.
I had never Page_Init Event in such manner before. I don't even know that it is logically true or not. But this can be temporary solution.

I can get Parameters sent in POST method in Page_Init Event (I don't know why it don't give any error there), I have just put all of them in session and Redirect the page.

It was solved currently.

Sachin
  • 2,152
  • 1
  • 21
  • 43