tags:

views:

454

answers:

5

Hi I just opened up a project I done in MVC a while back, fired right up I looked at in the browser and now all the sudden it just wont find the [HttpPost] & [HttpPostAttribute]. What can be the problem?

errormessage

The type or namespace name 'HttpPost' could not be found (are you missing a using directive or an assembly reference?)

EDIT: If I comment out the [HttpPost] I get that global is missing the UrlParameter and AreaRegistration?

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Principal;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using PROJECT.Web.Models;

+2  A: 
  • Go back one second.
Eddy Pronk
+1 hehehehehhehehe
used2could
Humour is always appreciated!
Evildonald
A: 

I would create a new ASP.NET MVC project. If this project fails you have deinstalled some needed parts, if it works your existing project is screwed up.

Malcolm Frexner
+5  A: 

You're probably referencing the System.Web.Mvc version 1.0.0.0 dll instead of 2.0.0.0. Check the reference to that, and if it's wrong, remove it and re-add the correct version.

Tortie
the project was done in MVC 1.. I dont know what happen I redone it instead, it was no big project so it was ok. thanks for reply
Dejan.S
+1 This was the problem in my case.
Mr Plough
+1 and mine ...
amelvin
A: 

I got the exact same problem and it was because i was referencing MVC1 rather than MVC2. In the properties that have the same build numbers of v2.0.50727

I managed to fix this problem by selecting the System.Web.Mvc and viewing its properties and setting the "Specific Version" to "True"

Evildonald
A: 

You can also check out Scott Gu's post here.

See the section named "Manually Upgrading an ASP.NET MVC 1.0 Project"

David Yates