[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1972
  • Last Modified:

ASP .Net MVC: The resource cannot be found.

I have my Index.aspx set in the correct location but I am receiving the following error after I clicked in Set as Start Page:

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: /Views/Home/Index.aspx
0
DistillingExperts
Asked:
DistillingExperts
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
If it is an MVC app then setting a start page won't work. The files with .ASPX extension aren't physical pages they are Views invoked by your controller. You don't navigate to pages, you invoke actions on controllers to get around.
0
 
AazmodeusCommented:
try:
<sitedomain>/Home/Index
or even simply:
<sitedomain>

MVC uses routing to bind aspx pages (views) to virtual urls.
If you open global.asax, you'll see routes added to routes dictionary on application start. There should be a default rule and you can add as many rules as you want.
Each route added to the table has 3 parameters:
 - Route name: can be any string, e.g. "a route to a view that display items in categories"
 - Route pattern: formatted string describing route pattern.
E.g. "{controller}/{action}/{category}/{id}". Here controller and action are reserved for controllers and their public methods, the rest must match the method parameter names.
 - Object with pattern default values: this one must have a field for each piece of pattern in {} brackets. Considering the pattern above that would be for example:
new {controller = "Catalog", action="Show", category="Kitties", id=3 }

Now this route says that  the application should try to find controller named "{controller}", which has a public method named "{action}" and this method must take two arguments named "category" and "id". If application doesn't find any matching controller or method it goes to the next route and tries to parse the url accorfing to it.

You can define different patterns, even without names of controllers, methods, paramters, etc.
For example:
"Dat route",
"/WhosYourDaddy",
new {controller="Data", action="Remove", id="root"}
Now visiting link "<sitedomain>/WhosYourDaddy" will end up in calling
new DataController().Romove("root");
0
 
DistillingExpertsAuthor Commented:
Sorry, but I didn't understand what I have to do to effectively fix my problem.
0
 
Carl TawnSystems and Integration DeveloperCommented:
Open your project properties page, go to the "Web" tab and remove the text from the "Specific Page" field.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now