Asp.NET MVC 5 Trace - asp.net-mvc

I am having some issue on MVC 5, when I am in any controller action the flow redirect to LogOff action method on Account controller.
I didn't find why that is happening so I want to know if there is any Trace or Debug, or Log, or whatever that I should look at to see why this is happening.
Any Idea?

I think you have mentioned this route logic somewhere thats why it is redirecting to logoff action method. Please check routeconfig, web.config and layout, where i think you will find something regarding this by which you can resolve this issue.

Related

MVC searching for view in wrong location

Base URL to run the my MVC app is:
http://localhost/RealSuiteApps/RealHelp/-1/Inbox/
And... I get this exception:
I know what it means :) But I dont understand why I get it, I have everything in place and the exact same code was working perfectly yesterday. What could go wrong?
Here is the code, you see I have InboxController, Index action in it, and of course the view under Views/Inbox/Index view
Most likely, this is a routing issue. Based on the error message, the Index action that's being loaded is actually in HomeController. MVC is searching /Views/Home/ for the view, so that means the controller is HomeController. You should probably post your RouteConfig.cs file for a more thorough answer, but generally, I can tell you that you need to look at your routes and figure out why the URL is not going where it should.

missing controller in .net mvc with elmah emailing me...driving me crazy

elmah is emailing me exceptions for missing controllers like so:
System.Web.HttpException: The controller for path
'/Scripts/modernizr-2.0.6-development-only.js' was not found or does
not implement IController.
I added some ignore routes to try and let the app know that scripts isn't a controller and to ignore all .js and .css files like so:
routes.IgnoreRoute("scripts/*");
routes.IgnoreRoute("*.js|css");
It's still emailing me the exception. at this point I want to just suppress the error because every single time I hit a page on the app, it triggers this email.
any suggestions to cure this?
Check that the script it is looking for actually exists in the site. I have had problems like this reported in Elmah, and as I remember, it was after a js library had been updated by NuGet, but the references in the views had not.
Hope that helps.

ASP.Net MVC 2 Areas: The partial view '...' was not found

We recently upgraded a project to MVC 2 and we'd like to use Areas but there is an issue.
We have created a new area, setup a controller, configured a route, and created a view in the correct location. When we run the code it successfully finds the route and hits the controller but when it goes to render the view there is an exception.
The web forms view engine doesn't seem to be looking in the Areas section for views. The error we're seeing is:
~/Views/<ControllerName>/<ViewName>.aspx
~/Views/<ControllerName>/<ViewName>.ascx
~/Views/Shared/<ViewName>.aspx
~/Views/Shared/<ViewName>.ascx
When it should be:
~/<AreaName>/Views/<ControllerName>/<ViewName>.aspx
~/<AreaName>/Views/<ControllerName>/<ViewName>.ascx
~/<AreaName>/Views/Shared/<ViewName>.aspx
~/<AreaName>/Views/Shared/<ViewName>.ascx
~/Views/<ControllerName>/<ViewName>.aspx
~/Views/<ControllerName>/<ViewName>.ascx
~/Views/Shared/<ViewName>.aspx
~/Views/Shared/<ViewName>.ascx
This would indicate that it's still somehow using the MVC 1 dll but we've looked carefully and can find only references to the V2 of MVC (there was a V1 reference in xVal, a third party DLL, but fixing that didn't make a difference).
I can only imagine that we missed something when we did the upgrade or that we've got some unusual edge case because there doesn't seem to be anything on the web that matches the problem we're experiencing.
What things could we look at that might help us resolve this issue?
Thanks in advance for any help provided.
Cheers,
Zac
What things could we look at that might help us resolve this issue?
Make sure Area Routes are Registered AreaRegistration.RegisterAllAreas(); are registered first. Area routes need to be registered as well.
Make sure generated URL links have the area name included as one of the arguments when using ActionLink and other related URL helpers
Sometimes just delete and re-add the Area from scratch. Sounds silly, but it works.
The related SO question on the left hand side of this page may help. I have linked one I think may be of value

Why isn't MVC using Error.aspx?

I'm trying to add some security to my ASP.NET 1.0 MVC app (VB), but I can't get it to work. At the top of my controller, I've got:
<HandleError()> _
Public Class HomeController
I'm overriding OnActionExecuting and throwing a SecurityException if the user is not in the proper role.
Everything I've read states that this should by default look for Error.aspx first in the current folder (Home) then in the Shared folder. I've got Error.aspx in both folders, and all I'm getting is a "Security Exception" yellow screen of death.
What am I missing?
do you have customErrors=On in your web.config
here
Do you have in your web.config? If mode="Off" or if you're accessing the site from the same box and mode="RemoteOnly", the debug page is shown instead of the error.aspx view.
If this is not the case, try creating an action on a controller that returns View("Error") and see what happens. I just had this problem recently and it was due to an error in the Error.aspx view itself. Rather than tell you there's a problem with the error view, the framework just goes ahead and displays the YSOD with the original error information.

ASP.NET MVC issue

I have a ASP.NET MVC app and when I run it, it loads my Index action on my HomeController
by default ok.
But when I put in this URl I get 404 - Not Found error
http://localhost/MyGoogleApp/Home/Index
This is the same for any action I put in in Home Controller.
Something fundamentally wrong, any ideas?
Malcolm
You probably have a configuration problem with URL mapping in IIS itself.
I haven't worked much with IIS7, but I think this is what you should check:
Managed pipeline mode should be 'Integrated'.
web.config should include system.webServer with all standard stuff new MVC project puts there (I can't check what exactly right now).

Resources