Authenticate action unreachable OpenId ASP.Net MVC4 - dotnetopenauth

I am following this example: OpenID Authentication with ASP.NET MVC3 , DotNetOpenAuth and OpenID-Selector
I started a new MVC4 project and add the OpenId code as suggested in the article above.
A break point on the Authenticate action in AccountController is unreachable.
Clicking on Google or Yahoo takes me to this blank page: http://localhost:37638/Account/Authenticate?ReturnUrl=

Shot in the dark: do you have appropriate bindingRedirects in your web.config file for MVC 1-3 to redirect to MVC 4?
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

An alternative to removing the Authorize attribute on the controller is to add the AllowAnonymous attribute to the action, that has fixed the issue for me.

Related

Assembly redirect from ASP.NET MVC area Web.config

I'd like to add an assembly redirect for some libraries used by only one area of my ASP.NET MVC app. Not to clutter to root application Web.config, I'd like to have these redirects in the Web.config of the area.
Is this possible? Adding the following code to the area's Web.config doesn't seem to have an effect (while working from the root Web.config):
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Diagnostics.Tracing.EventSource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.14.0" newVersion="1.1.14.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

ASP.NET MVC takes long time in login page in chrome

I Have a Route that is in the format:
http://localhost/SocialNetworkWeb/Home/Index
When I press login in any other browser it works fine but in Chrome it takes too long.
Is there any problem with ASP.NET MVC3 & Chrome working together or maybe IIS Express?
The browser shouldn't matter as all.
What kind of login is setup? Forms authentication, windows auth, etc?
Load the site while running Fiddler http://www.fiddler2.com/fiddler2/ and compare time/requests between browsers, there should be nothing via Forms Auth that differentiates it but Fiddler should give you a better idea - off the top of my head there's no browser specific issue coming to mind.
I found that the "TrueSuite Website Logon Extension" was the problem and once i disabled it every thing was back to normal, Thanks for your time everyone.
I recently ran into an issue like this but in MVC 4. I needed to set up assembly redirects in my web.config file. They look like this for MVC 4.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

Mixing MVC 1 and MVC 3

Is there a way to have a project use MVC1 in certain areas and use MVC3 in other areas?
I have some previous code written but I was thinking of using MVC 3 to add other features.
Thanks.
Have you tried just upgrading? What things do you need from MVC1 that you can't use in MVC3? There are breaking changes, but it's very likely that you won't run into any of them, or that you can upgrade those parts of your code to run the entire app on MVC3.
No, there is no way to mix ASP.NET MVC 1 and ASP.NET MVC 3 in the same ASP.NET application. And that's a good thing because you should never even attempt to do this. They should be in separate applications if migration is not an option for you at the moment.
As per my knowledge I think we can use MVC1 code by adding following code in web.config file.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Please correct if I am wrong.

Adding bindingRedirect element in web.config when upgrading from asp.net mvc 1 to asp.net mvc 2

I have got a question with regards to upgrading asp.net mvc applications from v1 to v2...
I've noticed in the ASP.NET MVC v2 Release notes that we need to add this code (please see below) when upgrading, but it did not state what would be the purpose of it because I've tried experimenting some of my apps to asp.net mvc 2 without adding this particular section in web.config.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc"
publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Would there be implications should I not place this?
Thanks!
What this code does is pretty much tells your entire project that if there happen to be any old leftover references to MVC 1.0, then it should instead go try and use the 2.0 version instead. And I believe this would be inherited by class libraries as well where you might forget to update references.

Using MVCContrib's WindsorControllerFactory with new Windsor Castle 2.0

I'm trying to use WindsorControllerFactory (the latest 1.0.0.916 version) together with the new Windsor Castle 2.0 (again, the latest version). But I'm getting the
Could not load file or assembly
'Castle.Windsor, Version=1.0.3.0...
error when starting the Web application. Anyway, during writing of this question I managed to persuade the Web app to bind to new Castle's dlls by adding this block to the Web.config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Windsor" culture="neutral" publicKeyToken="407dd0808d44fbdc"/>
<bindingRedirect oldVersion="1.0.3.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Castle.Core" culture="neutral" publicKeyToken="407dd0808d44fbdc"/>
<bindingRedirect oldVersion="1.0.3.0" newVersion="1.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Castle.MicroKernel" culture="neutral" publicKeyToken="407dd0808d44fbdc"/>
<bindingRedirect oldVersion="1.0.3.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
So I guess I answered my own question, but I wanted to share this with anybody having the same problem. Or is there a better way (apart from compiling the MVCContrib sources myself)?
I'd like to build MvcContrib myself too, and put its source along with our project code.
We use the same approach. There is one issue with the last available MvcContrib (v.2.0.96.0). It uses Castel.Windsor v.2.1.0.0 that is not compatible with the latest version of Castel.Windsor (2.5.1.0): AddComponentLifeStyle is obsolete. So you will have to change related MvcContrib code.
BTW, you can sign MvcContrib dlls without rebuilding them, for example with this tool: http://signer.codeplex.com/

Resources