私はasp.netmvcを初めて使用します。Asp.netmvc2を使用して単純なアプリケーションに取り組んでいます。ユーザー入力を取得して表示するコントローラーを作成しました。アプリケーションを実行すると、このエラーが表示されます。私のコード以下のとおりです。
Server Error in '/' Application.
The resource cannot be found.
コントローラー:
[HttpPost]
public ActionResult DisplayCustomer(Customer obj)
{
return View("DisplayCustomer",obj);
}
表示:
<% using (Html.BeginForm("DisplayCustomer","test1",FormMethod.Post))
{ %>
Enter customer id :- <%= Html.TextBox("Id",Model)%> <br />
Enter customer code :- <%= Html.TextBox("CustomerCode",Model) %><br />
Enter customer Amount :- <%= Html.TextBox("Amount",Model) %><br />
<input type="submit" value="Submit customer data" />
<%} %>
モデル:
public class Customer
{
private string _Code;
private string _Name;
private double _Amount;
public string Code
{
set
{
_Code = value;
}
get
{
return _Code;
}
}
public string Name
{
get
{
return _Name;
}
set
{
_Name = value;
}
}
public double Amount
{
set
{
_Amount = value;
}
get
{
return _Amount;
}
}
}
私は自分のアプリケーションを次のように実行しています/test1/DisplayCustomer
。それを解決するためにWebを閲覧しましたが、解決策が得られませんでした。どこで問題が発生したかを教えてください。