There is no information about error (asp net mvc 3) - asp.net-mvc-3

I have developed a website using ASP.NET MVC 3. The site works well on a local development server. I deployed site on the hosting using the publishing feature in visual studio 2010. When I launched the site, I saw a white screen.
Web.config
<system.web>
...
<compilation debug="True" targetFramework="4.0">
.....
</compilation>
<customErrors mode="Off"/>
...
</system.web>
Interestingly, the migration work correctly. In the database, all tables are created.
How to enable output of error information? I would be glad to any advice.

Related

Prevent redirect to site.mobile.master

When I run the web form template of Visual Studio 2013 on a mobile phone the master page is redirected to Site.Mobile.master by default. Is there any way to prevent this and how???
THANKS
you can fool the application adding the code below in your web.config inside
<system.web>
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<filter>isMobileDevice=false</filter>
</browserCaps>
</system.web>
The code should be placed within the <system.web> tag. Your web.config file may already contain the tag, so can be placed in the existing one.

web config errorMode

Hey guys I am kind of new to all of this so this might be a simple question but I want some clarification on this topic. I have a website and when an Http error occurs I send people to a customized page this works perfectly. The only issue is that it is also sending me to that customized page. I would like it so that I can see detailed errors on the production server (reason is that sometimes error pop up in production server and not in the development server) and send everyone else to the customized page this last part is done the first part I am having trouble with this is what I have in my web.config
<system.web>
<customErrors mode="RemoteOnly" />
<compilation debug="false" targetFramework="4.0" />
<httpErrors errorMode="DetailedLocalOnly">
<remove statusCode="500" subStatusCode="-1" />
//this is working
<error statusCode="500" subStatusCode="-1" prefixLanguageFilePath="" path="~/myerrors" responseMode="file" />
</httpErrors>
and my last question is how would the production server know that your LocalHost?
I suspect that you're confusing terminology here, so I'll try and clarify.
A connection from "localhost", in this context, means that you are connecting to the website from the same computer that the site is running on. This can happen if you're developing it on your local machine, or if you've used remote desktop to connect directly to the server and are browsing the site from that session.
If you are on your own machine connecting to your production server, you are no longer "localhost" - you are Joe Bloggs out on the Internet, the same as every other user, and you will get the same error page.
I would suggest adding additional functionality to the customised error page to pick up who is accessing it (if you are authenticating users), or using an external component such as ELMAH to help you with your error logging.

Publishing MVC site with Visual Studio to IIS 7 removes custom response headers from IIS config

I'm using IIS 7 and I've got a site setup with an additional HTTP response header (X-UA-Compatible header).
I'm deploying an MVC4 project remotely to IIS using the Publish feature in Visual Studio 2010, which uses Web Deploy.
Problem is, every time I publish the site, the HTTP response header gets removed from the config in IIS - is there some way I can prevent this?
I figured it out - when you set headers at the site level in IIS 7, it alters the web.config file. I needed to add a customHeaders element in the web.config file that is deployed:
<system.webServer>
...
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
...
</system.webServer>

ASP.NET MVC - Can't log into the system using IE after publishing to server

I have a project created in ASP.NET, MVC 3, C#. It works in every browser when testing it on my dev machine, once published it works fine in chrome and every other browser apart from IE.
The problem - I am trying to login to my site but the web site just refreshes with the return url included in the url.
I have tried the following:
Removed helpers
Removed webMatrix
Added the following to the web.config:
<add key="enableSimpleMembership" value="false" />
<add key="autoFormsAuthentication" value="false" />
Checked my internet options settings, they are currently set to medium-low and Enable Protected mode, I have also turned this off and had no joy.
I have another web site that has been deployed to the same internal server and works fine
in IE.
Does anyone have any idea what would be causing this problem?
Here is my Web.config:
http://pastebin.com/0b5FBuTs
I am using IE9
THanks

ASP.NET MVC 3 Areas and multiple authentication in web.config

I have been attempting to follow this blog to get Areas working:
http://mstechkb.blogspot.com/2010/10/areas-in-aspnet-mvc-20.html
In the blog post, it identifies the ability to have authentication set per Area, e.g.:
<location path="Area1">
<system.web>
<authentication mode="Windows" />
<authorization>
<allow roles="role1,role2"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
However, when I try to create this in a new project in Visual Studio 2010 I get the following error when I run:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
From what I can see this is because you cannot specify an authentication element unless it is in the top level web.config.
So it is possible to do what the blog post says? Can you have Areas with Authentication elements inside Location elements in the web.config?
What I have learnt about ASP.NET MVC, it's always better to set the authorization rules with [Authorization] attribute applied to individual controllers, because it is safer and more adequate considering the way routing system works.

Resources