C#(SPA) template does not run

Asked

Viewed 27 times

1

I was auditioning with the Single Page Application, using the visual studio template. Well, I created the project and did nothing, nothing at all, I just created the project and I circled and running gave me this error:

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Valdiateantiforgerytoken' could not be found (are you Missing a using Directive or an Assembly Reference? ) Teste_spa C: Teste_spa Teste_spa Controllers Managecontroller.Cs 200 Active

The point is that the namespace: System.Web.Mvc is already in the project. If it is reference, which I add?

  • I believe it is an error in the project template, because ValdiateAntiForgeryToken does not exist - seems to be a typo on ValidateAntiForgeryToken.

  • @Renan, I didn’t type anything. Just build the project and went to rotate to see his face, just this. Nothing was typed. The attribute was already there.

  • That’s why I say the error is from the template. It looks like a typo from the author of the template, not yours. When you create a project through Visual Studio, you use a template (in this case, SPA), which has a responsible author. This is bad for Microsoft, which provides the template. I believe that fixing the error is a first step for the application to run.

  • @Renan This template is most likely not from Microsoft. For all effect, Renan is right, is a typo of who made the template, or the error message in the question is not exactly equal to what is shown to you.

  • @Renan, thanks. Now I understand what you meant by typo. I solved it. Thank you so much for the help and no resolution. We need this, to show us the way only and not do for us. Thanks. Put as an answer that mark the answer.

  • @Renan, just one question. When I start the project, the page that comes is Login and not Index or Home and I can’t change it.

  • @pnet may have specified some form of authentication by default - and as the user has never authenticated, it is directed to this page. I think it is worth opening a question just for this, and also check the web.config to see if there is something about the required form of authentication.

Show 2 more comments

1 answer

1


Apparently this is a typo - but not yours!

The expression ValdiateAntiForgeryToken present in error message looks a lot like the method ValidateAntiForgeryToken, that should be right.

You create applications and solutions in Visual Studio from a template, which is the basic definition of an empty project. Visual Studio provides several templates, not all from Microsoft, for you to create an application "from scratch". What seems to have occurred here is that the author of the template you use made a typo, so this will affect all developers using the same template.

I believe fixing the template author error is the first step in getting your application to work - but given such a basic error in a template made available for VS, I would be worried about other errors that the template might have.

In time: my confidence in the correctness of official Microsoft templates is quite high. If I had to bet, I’d say this came from the Visual Studio gallery.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.