Ich habe ein Problem in MVC.Der Typ oder Namespace-Name 'HttpGet' konnte nicht gefunden werden, wenn 'System.Web.Http' Namespace
Derzeit arbeite ich in MVC und die Version ist MVC4. Und ich 2 Action Methode haben, siehe unten
[HttpGet]
public ActionResult About()
{
ViewBag.Message = "Your app description page.";
return View();
}
[HttpPost]
public ActionResult About(ModelName ccc)
{
ViewBag.Message = "Your app description page.";
return View();
}
Wir brauchen die using System.Web.Mvc;
Namespace für [Httppost] und [HttpGet] Attribute. Also habe ich den Namespace using System.Web.Mvc;
in meinem Controller hinzugefügt. Aber ich muss einen weiteren Namespace hinzufügen using System.Web.Http;
für httpsresponsexpection Fehlerbehandlung in meinem Controller .Si ich im Namespace hinzugefügt. Zu diesem Zeitpunkt funktioniert System.Web.Mvc;
nicht.
I got this error: The type or namespace name 'HttpGet' could not be found . Why ? anything relation between System.Web.Mvc and System.Web.Http for HttpGet ?
Vielleicht ist Ihr Problem irgendwie im Zusammenhang mit dieser ist: http://stackoverflow.com/questions/10939239/visual-studio-2012-rc -could-not-load-type-system-web-http-routeparameter – jAC
Okay! Aber sie haben dll Problem, aber ich habe nicht dll Problem, das alles funktioniert gut, aber wenn ich System.Web.Http Namespace dann HttpGet Attribut funktionierte nicht! –
Bitte noch einmal meine Frage sehen !! –