ASP.NET MVC (Form login): Validation of viewstate MAC failed - asp.net-mvc

Im trying to use ASP.NET login controls, in a ASP.NET MVC project and i get this error, when i click the submit button:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I have searched google and tried alot of solution, which worked for others including:
- Install .NET 3.5 SP1
-
- Check if there is only 1 on the page
Unfortunaly notthing works. Do you guys have any other suggentions?
/Thanks

Create a new MVC Webapplication and take a look at how FormsAuthentication is done there. You can't use the Login Controls.

Related

Sharing Session through Webforms and MVC application

I have a webforms project and an MVC project but the login is only one that is through the webforms project. In the home page, we gave the user to select the project either MVC or web forms, if the user selects the MVC project then we are redirecting to MVC project but the real problem came at the time of authorization.
I am unable to get the session variable from Web forms to MVC
I am using SQLServer mode and cookies enabled
Please help me in this
Thanks

Using ELMAH inside my asp.net mvc 4 & MVC5 web application

I have two asp.net mvc web applications; asp.net mvc4 and asp.net mvc5 , they are both deployed under iis7 on two separate VMs.
now i am currently facing problems when un-handled exceptions are raised,,, because users will be re-directed to the Error view inside the shared folder under the view section. and i am unable to know exactly the exception details..
so i have read about using the ELMAH tool which will automatically logs all the UN-handled exceptions. but my question is that what are the steps that i need to follow to configure the tool inside myC application ?
second question; will ELMAH works on asp.net vmc4 and asp.net mvc5 in the same way?
Third question. now i have custom error set to <customErrors mode="RemoteOnly" /> inside my live asp.net mvc web application, since i do not want end users to be exposed to the technical details about any exception, so when using elmah should i set the custom error to be no ?
Thanks
1) Just install Elmah from Nuget. That will enable it with the default configuration to save exceptions to an XML file
2) Yes, it should work both in MVC4 and 5
3) No, you can leave it as it is. The Elmah page is available locally only by default. Users will be still redirected to your Error page, and you can use the elmah URL locally to access the actual error information.

How to open MVC 4 view page from webform.aspx page?

basically i am looking for something like this ,
i got webform.aspx page and have button there, if i click on it i need to show MVC view page
idea is i want app with webform and mvc !
what i am trying is :
http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc
but here i am confused about webconfig settings
please help me to get it done,
thanks
Scott Hanselman has a good guide on integrating MVC with a Web Form App, it should take you through the steps, here it is in a nutshell:
Run the Upgrade Wizard (open the Visual Studio2008 Web Application
in Visual Studio 2010)
Create a default ASP.NET MVC application for reference (you'll throw it away later)
Use a differencing tool like Beyond Compare to integrate the new web.config entries from the ASP.NET MVC sections into the upgraded ASP.NET WebForms application

self hosting asp.net mvc

Is it possible to self host asp.net mvc inside another application ie. console, windows forms, service etc etc.
I'd like to build an app that offers a web interface to control it and I'd like to use asp.net mvc for the web part of it.
I did take a quick look at Nancy which looks like it would work, though its not asp.net mvc it did support razor although it doesn't have quite the same level of support for it as asp.net (eg. strongly typed views)
I did also find this question but it doesn't really go into much depth
Possible to use ASPNET MVC2 without IIS?
You can use "IIS 7.0 Hostable Web Core" and host the web server as part of any user process, even a console application. The benefit is that it is very similar to full blown IIS (incl config etc) but the web server itself is running in your process.
Have a look at the following articles:
Host your own Web Server in your application using IIS 7.0 Hostable Web Core
Creating Hosted Web Core Applications
Please have a look at http://cassinidev.codeplex.com/
It has many advantages for example
No need IIS 7 on client machine
Support MVC (I have tested myself)
Work well with Windows Form and Web Browser Control for packaging as Windows App
Cross Win OS platform ( Windows XP, Vista, 7) I have test XP with .NET 4 installed
Hope this helps.
I know this question is old, but it is still relevant, so with the .NET Core 1.0 + ASP.NET MVC 6 you can self-host your MVC application easily. You can even combine MVC and WebAPI applications into one, and you can decide later if you want to use IIS, IIS Express or the self-hosting feature of the .NET Core.
You can try it if you follow the Yeoman approach from this post:
https://stackoverflow.com/a/30314393/980247

WebMatrix social authentication MVC integration

Is there any article or ideas how to use/move/intergrate social authentication from WebMatrix 2 to MVC 4. I've googled internet but didn't found any info about possibility to add references to WebMatrix namespaces/libraries to MVC project. I've read following article http://www.asp.net/webmatrix/tutorials/the-top-features-in-web-pages-2-developer-preview#oauthsetup and want to use WebMatrix.Security in MVC project
If you're looking to upgrade your project from simple ASP.NET Razor pages to a full MVC 4 project, I recommend moving from WebMatrix to Visual Web Developer:
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-web-developer-express
Everything you're trying to do here with the social auth libraries should work perfectly well in VS, and there are even a few NuGet packages that can make it easy. WebMatrix is meant to get you running with ASP.NET and Razor, but VS is going to give you a fuller experience.
Happy Coding!
here you will find a step by step solution to migrate webmatrix-webpages apps into asp.net mvc. check that you can find the login area - were you will figure out the social auth login too - in order to migrate it to mvc too.
information:
The Web Pages page-centric programming model supported by WebMatrix is a great way to get Web apps up and running. If you later decide that embracing ASP.NET MVC would give you more flexibility, you're covered. We’ll explain why you might choose to migrate and show you how to do it.
read the article: http://msdn.microsoft.com/en-us/magazine/hh148144.aspx
download code: http://archive.msdn.microsoft.com/mag201105ASPNET/Release/ProjectReleases.aspx?ReleaseId=5601
OAuth authentication on website now built-in, question closed

Resources