Click here to Skip to main content
15,868,161 members
Please Sign up or sign in to vote.
2.21/5 (6 votes)
See more:
Hi All,
Before selecting any page it is by default showing the home page. when i select one partiicular page it is showing this error. it is developed by mvc3 (Razor). Can any body help me in Razor which page runnig first or how can i go back?



\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.cshtml


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Posted
Updated 10-Aug-23 11:42am
Comments
[no name] 9-Jul-12 14:07pm    
Well... gee... offhand I would say that your application or IIS cannot find Views/home/Index.cshtml. Is IIS configure correctly? Does that page exist in that location?
Ben Smith Nov2021 15-Nov-21 16:14pm    
had
khosnur 9-Jul-12 14:10pm    
thanks for reply. Yes sir the page is there but why it doesn't find it i don't know.I am using IIS 7.5. what type of configure is needed? can u tell me clearly plz... thanks in advance

One reason this could occur is if you don't have a start page set under your web project's properties. So do this:


  • Right click on your mvc project
  • Choose "Properties"
  • Select the "Web" tab
  • Select "Specific Page"
  • Assuming you have a controller called HomeController and an action method called Index, enter "home/index" in to the text box corresponding to the "Specific Page" radio button.


Now, if you launch your web application, it will take you to the view rendered by the HomeController's Index action method.

(or)

Simply, you could also open one of the controllers in your project and then hit on F5 or Ctrl + F5.

What's happening now is that, you are currently in your /Views/home/Index.cshtml view and you just hit on F5 or Ctrl + F5. In an mvc project, you cannot open a file w/ .cshtml extension directly as IIS cannot understand that. The controller is supposed to return a matching view from within the action method.

As a side-note also check if you have MVC 3 installed correctly. If my answer doesn't help, I am sorry.

Hope this helps!
 
Share this answer
 
Comments
khosnur 9-Jul-12 15:18pm    
thank you very much sir it's working now. deep love from my heart. what can i do for u. one thing i did that i voted u. i have another question plz reply that.
Pratik Bhuva 18-Sep-13 5:43am    
Thank You So much...
khosnur 9-Jul-12 15:27pm    
Karthik Sir, I have one site developped by MVC3 running by IIS 7.5 on win 2008 r2 Server Back End Oracle.When i run the application first page coming no problem but when i giving user name and password its showing this error:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.

But the Application running smoothly on 2003 server. How can I solve this big problem plz help me. Thanks in Advance...
Karthik. A 9-Jul-12 15:39pm    
You are welcome! An internal server error could occur for numerous reasons like - incorrect database server, incorrect username / password etc etc. The best way to approach this would be to find out what's the actual error. You have said that you could see the 1st page, but the error happens after you enter the user name/ password. What type of authentication does your web application / site use ? See if it's setup correctly in IIS under the "Authentication" module. Also, go to the server and visit your page there, instead of from a machine that just acts as a client. If you use the server itself, it will give you much more information than a useless "500 internal server" error. If you could do that and see the actual error, it might be helpful If you have qns. post it here and one of us will help! Its difficult to help w/ just the general 500 error...
Sharyu Dhable 16-Dec-16 2:15am    
Thanks , its working
simple solution

C#
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. 


simple eg. in view i have a AHU folder and i make index.cshtml page this page run properly but i make this folder new page add.cshtml and now run i get Error (above).This type error solution is please check method/function in your controller page like
C#
public ActionResult add()//your view page
       {
           return View();
       }


I hope you get your answer
 
Share this answer
 
Comments
Richard Deeming 16-Aug-16 9:17am    
This question was asked, answered, and solved over FOUR YEARS AGO.
Huzaifa Abbas 2-Mar-18 6:30am    
Hello Sir,

I have a same problem, my project runs good on the localhost but after publish on online server it returns this error.

Please help, Thanks in advance

Sorry for my english
[no name] 1-Oct-18 11:39am    
Where please
Richard Deeming 1-Oct-18 13:53pm    
Solution 1[^], which was accepted by the OP in July 2012.

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