Click here to Skip to main content
15,614,257 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new at MVC. I have set up a MVC4 model: Customer.cs with ID, Code and Amt in a class structure.

I get the error:
Server Error in '/' Application.

The resource cannot be found. 
  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

 Requested URL: /Home/Input

Imports Mvc4test.Customer
Namespace Mvc4test
    Public Class CustomerController
        Inherits System.Web.Mvc.Controller

        ' GET: /Customer

        Function Index() As ActionResult
            Return View()
        End Function
        Function Output() As ActionResult
            Dim Cust1 As Customer = New Customer()
            Cust1.ID = Convert.ToInt32(Request.Form("id"))
            Cust1.Code = Request.Form("code")
            Cust1.Amt = Convert.ToDouble(Request.Form("amt"))
            Return View()
        End Function
        Function Input() As ActionResult
            Dim Cust0 As Customer = New Customer()
            Cust0.ID = Convert.ToInt32(Request.Form("id"))
            Cust0.Code = Request.Form("code")
            Cust0.Amt = Convert.ToDouble(Request.Form("amt"))
            Return View()
        End Function

    End Class
End Namespace

For each "View" I did a "Build". I selected strong-typed view for each and selected "Customer".

@ModelType Mvc4test.Customer

    ViewData("Title") = "Input"
End Code

    <center><table><tr><td><br /><br /><br />
        <h5>Customer ID#</h5></td></tr><tr><td>
        @Html.TextBox("id")</td></tr><tr><td><br />
        <h5>Customer Code</h5></td></tr><tr><td>
        @Html.TextBox("code")</td></tr><tr><td><br />
        @Html.TextBox("amt")</td></tr><tr><td><br /><br />

        <input type="submit" value="Input Customer Data" />

@ModelType Mvc4test.Customer

    ViewData("Title") = "View1"
End Code

            ID: @Html.TextBox("id")<br />
            Code: @Html.TextBox("code")<br />
            Amount: @Html.TextBox("amt")<br />
            <% if (Model.Amt > 100)
               { %>
                    Priveleged Customer
            <% }
               { %>
                    Normal Customer
            <%}  %>

1 solution

Could you be more specific with the issue, because you are giving your code, but, I don´t have any way to know where your Views are, did you generate your views from the controllers?, check your RouteConfig.cs, be more specific, not with the problem, with the things you are doing...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900