Last post Oct 10, 2016 11:37 PM by dano_68
Oct 10, 2016 07:16 AM|dano_68|LINK
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.
Oct 10, 2016 03:51 PM|RichardY|LINK
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.
Oct 10, 2016 04:54 PM|ryanbesko|LINK
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.
Oct 10, 2016 11:22 PM|dano_68|LINK
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.
will look into that
Oct 10, 2016 11:37 PM|dano_68|LINK
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!