Reputation: 158
I'm currently learning ASP and I can't link an ActionLink in my View to an ActionResult in my Controller. Here is my code :
ViewFiles.cshtml
@Html.ActionLink("Download", "Download", "UploadController")
UploadController.cs
public ActionResult Download()
{
return Content("<script language='javascript' type='text/javascript'>alert('Hello world!');</script>");
}
I'm just trying to return an alert for now to see if it works but I get a HTTP 404 error.
Upvotes: 0
Views: 105
Reputation: 629
Change UploadController to Upload: @Html.ActionLink("Download", "Download", "Upload")
Try this (return JavaScript result on your ActionResult):
public ActionResult Download(){ return JavaScript("alert('Hello world!');"); }
Upvotes: 2