locked
The resource cannot be found - Only for new files RRS feed

  • Question

  • User473422738 posted

    I have an already live website using Razor engine.  Working fine.

    I need to make a new web page, so I copied an working file (cshtml) and just changed the text, gave it a new name, nothing else.

    When I uploaded it to the web server I get the now famous:

    "Server Error in '/MYWEBSITE' 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: /MYWEBSITE/STUFF/mynewpage.

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34280"

    I used Microsoft Visual Studio 2012 for Web.

    I did a further test and copied an existing page, made no changes, just renamed it - same error.

    I then created a new page by Add - same error.

    I can change existing pages, save, and no problem.

    It is only NEW pages I make it cannot load.

    So I assume it is a compilation error with the Web Config or something, but I have tried everything with no luck.

    Time to go back to MS Frontpage I think.  At least that was simple and logical.

    Monday, October 10, 2016 7:16 AM

Answers

  • User2117486576 posted

    I have an already live website

    Are you sure that you have a website and not a web application?  This sounds like what would happen if you have an Asp.Net MVC web application.  If so you will need to add an action to a controller class which in turn will serve the cshtml file in response to the request.  You will need to recompile/deploy the application not just the cshtml file.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 10, 2016 3:51 PM

All replies

  • User2117486576 posted

    I have an already live website

    Are you sure that you have a website and not a web application?  This sounds like what would happen if you have an Asp.Net MVC web application.  If so you will need to add an action to a controller class which in turn will serve the cshtml file in response to the request.  You will need to recompile/deploy the application not just the cshtml file.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 10, 2016 3:51 PM
  • User2053451246 posted

    Is it a Web Page site or MVC site?  If MVC you need to have a controller with an action method that has the same name as your page.

    Monday, October 10, 2016 4:54 PM
  • User473422738 posted

    Hi Richard,

    thanks for your tip.  I am not sure as someone else created the site.  But I will try your advice and see how that goes.

    Monday, October 10, 2016 11:22 PM
  • User473422738 posted

    Thanks Ryan, 

    will look into that

    Monday, October 10, 2016 11:22 PM
  • User473422738 posted

    Yes Richard, you were spot on.  It is a Asp.Net MVC web application and I was able to figure out how to create a new controller and redeploy.  Your advice was a life saver!  That said, this is a very cumbersome way to do a simple update.  But anyway, it is what it is...cheers!

    Monday, October 10, 2016 11:37 PM