Solved

ASP .Net MVC: The resource cannot be found.

Posted on 2011-02-22
4
1,807 Views
Last Modified: 2013-12-17
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
Comment
Question by:DistillingExperts
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34953616
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
 
LVL 2

Expert Comment

by:Aazmodeus
ID: 34954071
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
 

Author Comment

by:DistillingExperts
ID: 34958847
Sorry, but I didn't understand what I have to do to effectively fix my problem.
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34958884
Open your project properties page, go to the "Web" tab and remove the text from the "Specific Page" field.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now