Server not found after external login MVC - asp.net-mvc

Hello I use the code from https://coding.abel.nu/2014/11/using-owin-external-login-without-asp-net-identity/
and I was getting the error "The page isn't redirecting properly". after I login to my provider.
I clear my cookies but now when I log in to my provider but I get "Server not found". "Firefox can't find the server at login;jsessionid=f09ba421eeee23eab2a1ffa8b6ed35c3." in the url it returns https://login;jsessionid=f09ba421eeee23eab2a1ffa8b6ed35c3/. My provider is CAS. This is for firefox. In chrome it just brings a blank page.
I try it also with Google but I get same errors.
Any idea?
thank you

I believe I had the similar bug, there was one line solution to this bug...
"here is a bug in Microsoft's Owin implementation for System.Web. The one that is being used when running Owin applications on IIS. Which is what probably 99% of us do, if we're using the new Owin-based authentication handling with ASP.NET MVC5.
The bug makes cookies set by Owin mysteriously disappear on some occasions..."
solution here: https://github.com/KentorIT/owin-cookie-saver

Related

Not able to access my MVC 5 web application after adding MS Identity

I created my app using a template. After that i managed to connect it with an existing database. Then i tried to add Identity so that i will be able to authorise and authenticate users of the application. I tried to do that following the instructions of "shyamal parikh" in this post Adding ASP.NET MVC5 Identity Authentication to an existing project
My problem is that now i get a 401 error unless i got to solution explorer (in VS) and disable the windows authentication. But when i do that all the users have unrestricted access to the whole application.
I assume that the problem has to do with that solution that i performed but i cant comment directly there.
Can anyone give me a hint as to what i might be doing wrong?
Do you have windows authentication installed on your computer? Maybe adding that might help. Here are the instructions-
https://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/providers/add
Also look at your event viewer, you might have some hints there.

Microsoft Sign-In for ASP.NET MVC 5 web role

I have created Azure cloud service and in this cloud service I have a web role serving as a MVC web application. I followed this tutorial to use Microsoft account as the external authentication. When I try with the localhost it works perfectly. However, after I deploy the cloud service, I changed the redirect URL to the site url which is http://109e199cf5864b50ab25ac839f8c151d.cloudapp.net/. But this doesn't work. I can reach the authorization part, but after I login with the Microsoft account I got Error Message: An error occurred while processing your request. What should I do to make it work?
UPDATE:
I tried to remove the [Authorize] tag in my controller so that I don't need to login to see the view. After I deployed again, I got the Error Message directly!!
I didn't login at all! I checked the code this Error Message is actually the Error view from the template in the Shared folder. But there is no change of the code to return me this Error view! What I am missing with the deployment here?
In the comments of the blog post you referenced, the author (Ben Day) said there was an update to the redirect URI.
With the latest version of the ASP.NET Identity code, the redirect uri is a different value. So on account.live.com, the redirect url value for your app is now going to be “http://myapp-url/signin-microsoft”.
You may want to check that you have the correct values here.

Google Auth does not work in template asp.net mvc project

So I have VS 2013 update 4 and I created ASP.NET MVC application from template and configured Google authentication by using UseGoogleAuthentication method and passing client ID and secret. But for some reason once I click 'Accept' button google page I'm redirected to the page I expect but there is an error 500 in the browser console and nothing on the page itself.
I read a lot of articles and enabled all required APIs in Google Developer console. But nothing seems to work for me.
Also I have another custom authentication middleware that worked just fine before and stopped working once I enabled Google. I use nuget package version 3.0.1.
If I disable my custom auth middleware Google still does not work.
Please advise.
OK, here's why should probably stay with default values. So default redirect URL is /signin-google built-in to Google middleware. And because my URL is /Account/ExternalLoginCallback I thought it was a good idea to set it when configuring GoogleOAuth2AuthenticationOptions.
Once removed CallbackPath = new PathString("Account/ExternalLoginCallback") from configuration it just worked.

IIS 7 Not find the _Layout.cshtml

I am having a problem with a MVC application. When I publish it, I have the follow error:
The layout page "~/Views/Login/_LayoutLogin.cshtml" could not be found at the following path: "~/Views/Login/_LayoutLogin.cshtml".
I had the same problem once.
I figure out that it was an IIS permission problem. I went to the Application Pool and to the Authentication options. Then I edited the Anonymous Authentication Credentials to "Application pool identity"
Here is an answer in another post that have a better explanation about the solution
https://stackoverflow.com/a/6156675/2430118
Pedro

Asp.net MVC and IIS 7 Remove Basic Authentication in web.config

I published a site with a web hosting company and when someone hits the URL for the first time they are being prompted to log in using basic authentication. If you hit Cancel the site loads successfully and the user is not prompted again with the dialog box.
I contacted support and they are telling me (in a canned response) that it’s a programming issue. Is there something in the web.config that I need to either add or remove to stop basic authentication from happening on the first request?
Site is built with asp.net mvc 2, .net 4, and IIS 7. Thanks in advance for your help!
UPdate: I am using Forms based authentication on the site which is working once you click cancel on the Basic Authenciation dialog window.
Figured out the answer my question. I had to connect to the web site using IIS Manager and then disable Basic Authentication and enable anonymous.
Look for the authentication mode tag in the web.config (system.web node). Set the mode to "None".
So it will look something like this:
<authentication mode="None" />

Resources