reset password MVC core 2.1 template with identity scaffold cannot find _Layoutlogin .cshtml - asp.net-core-mvc

I am getting an error with my asp.net core 2.1 MVC project template. It looks like _Layoutlogin .cshtml is not able find. File is there in the shared folder and the only thing is that in the error message before .chmtl there is space at the end. This is happening after scaffolding idenitity
An unhandled exception occurred while processing the request.
InvalidOperationException: The layout view '~/Views/Shared/_Layoutlogin .cshtml' could not be located. The following locations were searched:
~/Views/Shared/_Layoutlogin .cshtml
Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executingFilePath, string layoutPath)

I suspect you have a typo some place if you check _Layoutlogin .cshtml there is a space in their so if in fact your file is _Layoutlogin.cshtml its not going to find it.

Related

Web API 404 File or Directory not Found for "root" routes

I am developing a RESTful web api service. It's web api v.1, not v.2. Also I am developing on Visual Studio 2010 SP1. I have installed the MVC 4 for VS2010 SP1.
Please understand and keep in mind that Upgrading to newer versions of VS or Web Api 2 is not an option.
I have the following problem after a Windows Update ocurred.
When I try to use my RESTful api this way....
http://url.com/documents/ (get all the documents) I get the following error...
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.
Here is the stack trace.
[HttpException]: File does not exist. at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath) at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) at system.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
If I specify the action name directly, it works. For example...
http://url.com/documents/get (gets all the documents) or
http://url.com/documents/7 (gets document id=7.
It only fails when you call it by its default name. I have already read similar situations here and I have tried to follow their solutions but they are not working for me properly.
Now, I know this is not a "web api routing" issue because I actually get the .net default exception page html markup (I am using Postman to test my webservice). When I force a "routing issue", then I get a JSON error description, which means that the Controller actually got created in the pipeline and returned a response.
Also, I have a custom file (SecurityHandler) that inherits from DelegatingHandler. This file gets executed almost first in the pipeline with each call to the api. Even before the actual Controller. Well, this file is never called when I get the error, which confirms to me that the "webserver" (either VS Development Server or IIS 7) is the one throwing the exception.
I have exhausted every single solution that I have found here. Change my web.config to multiple handlers configurations, re-installed MVC 4 for VS2010, created an entire new project... all these efforts have shown no results whatsoever.
Like I said, this was working perfectly fine until my pc restarted from a Windows Update BUT... why does it fail in the server as well? I did deploy my api to the server after the error started to occur.
Thanks.
The issue is not in Web API (and has nothing to do with it's version or Visual Studio 2010), it's the static file handler trying to serve and failing.
Alternatives:
0. Do you have a documents folder in your site? Get rid of it.
1. Remove the static file handler for directory browsing and re-add it.
2. Use RAMMFAR (less recommended)

the type exists in both asp.net

I just integreated blogengine.net into my exting webapplication(not a website)
To do this I have converted all blog engine pages into webapplication page. set namespace references according to the application folders
I have built solution successfully.But when I run main application following error occured.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'MyStore.App_Code.Controls.PostPager' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\6332283b\32bb0d6a\App_Code.afjt0bia.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\6332283b\32bb0d6a\assembly\dl3\faca6d87\a3e83425_6ad8cd01\MyStore.DLL'
I have checked all the namespace refferences but I haven't found any duplicate refferences.
please help me to get out of this.
Move your code files out of the App_Code folder and put them in a Classes folder.

MVC3 using nHibernate

I have an MVC3 project using nHibernate, Rhino and Castle. I finally got all of the components in place. I think. At least it runs and invokes the IWondsorContainer CreateContainer() method....after that method, the Application_Start does not fire and I get the message:
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/Proposal/Index.cshtml
Any ideas? I don't know what to make of this. Thanks
You seem to be requesting a view directly: /Views/Proposal/Index.cshtml. In ASP.NET MVC you do not request a view. You request a controller action. So in your browser the url should be /Proposal/Index or simply / depending on how your routes are configured.
I suspect that you had the focus on this Index.cshtml when you hit F5 in Visual Studio which has this ugly habit of following the url. You could define a start url in the properties of your web project to avoid this behavior.

How to display full error in asp.net 4

I've started with an asp.net mvc 3 and I have a problem, with some error:
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: /Movies
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225
I know what it means but I know sure if it is a true.
I want to get a full Yellow Screen of Death.
Looks like there is something wrong with you routes. Check the global.asax file to see if the url paths are configured correctly
I think the routing data might not be set correctly. People often make this mistake with asp.net mvc. You can download the Routing Debugger to find out why the path you requested cannot be found.

Web Service error 'Could not create type' when calling service from Ajax

I've downloaded the Ajax Control toolkit
When I create a website from the Ajax control Toolkit template, I can create a web service in a single file (asmx) and hook this up to different Ajax controls provided in the toolkit.
However if I add the Toolkit to an existing ASP.Net 2.0 appliction web project I cannot create web services in a single asmx file. If I create a web service VS always creates a code behind file as well. As a result of this calls to the web service (or loading the service directly in the browser) generate the following error:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'AddAjaxToApplication.List'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="List.asmx.cs" Class="AddAjaxToApplication.List" %>
Does anyone know how to resolve this?
Thanks,
Tim
I fixed this in the end.
In VS 2005 I just needed to right click on the web service and select "View Markup". I just changed the markup to use the correct namespace:
Line 1: <%# WebService Language="C#" CodeBehind="List.asmx.cs" Class="List" %>
I Just removed the project name from the namespace to match the namespace used by List.asmx and this error went away.
In my instance I had renamed the class something different than the .asmx file, so when referencing the file from the .aspx code it would generate this error.
So I had 'AjaxManager.asmx', but had renamed the class to 'AjaxService', and the markup did not match. In my case, leaving the fully qualified namespace did not cause any issue. So if you change the class name (probably not reccomended anyway), make sure to correct the markup as well as shown below:
<%# WebService Language="vb" CodeBehind="AJAXManager.asmx.vb" Class="MyProject.UI.AjaxService" %>
One more Important Things and simple solution that i found out while creating web service . Try to avoid creating code behind file
I was facing same problem while accessing web service in a virtual directory in iis 7 , then i created inline code asmx file and then access it , it was accessible
I solved the problem by moving the code behind file MyService.asmx.cs to the App_Code directory.
I solved this by ensuring that MyService.dll was deployed in the /bin folder below my Web.config.
Check in the Published folder if the path for the specified class files really exist or not, For me the App_Code folder was not present in the published directory so I manually placed the folder there and it is working perfectly :-)
I solved this by giving the full path of the codebehind like this
CodeBehind="~/codebehind.asmx.cs"

Resources