Base solution for your next web application

Activities of "neeraj k"

Hi

For the time being, I have a workaround to this issue. As per the article, the default language is stored in main table and other languages are stored in translation table. But I put default language too in translation table and not using the main table fields anywhere in the app to display.

I have to put all languages entry in translation table. It has solved the problem for the time being. The extra updates are happening but it does not affect the working.

So, as per my idea, we can add some fields in entity having notmapped option on and thus those will never gets updated in database because those will not be there in tables. I did not try that because of time limitations, but will check in some days.

Thanks Neeraj

Hi All

Right now, asp.net boilerplate framework supports localization for resources which is working well in system. I have to work on a site which is completely multilingual along with the data entered in the system. So, to do this, I have followed an article on codeproject

<a class="postlink" href="http://www.codeproject.com/Tips/369845/Localization-with-Entity-Framework">http://www.codeproject.com/Tips/369845/ ... -Framework</a>

Now the issue I am facing is, because framework automatically saves changes at the end of the request, it also updates my tables. Basically, somehow i need to avoid the automatic update. One way is to modify the framework and remove the code which is saving changes at end of request and calling savechanges manually. Is there any other way ?

Thanks in advance for any help.

Found the issue, very strange and I found it after a lot of hit and trials. Not sure why, but writing it here in case it solve someone else's time

The code is same that I pasted before in my question, with a small change. The code lines

app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });

Need to pasted at last of function, so the correct code that is working for me is

app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            app.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions
                {
                    ClientId = clientId,
                    Authority = authority,
                    PostLogoutRedirectUri = postLogoutRedirectUri,
                    //AuthenticationMode = AuthenticationMode.Passive,
                    Notifications = new OpenIdConnectAuthenticationNotifications
                    {
                        AuthenticationFailed = context =>
                        {
                            context.HandleResponse();
                            context.Response.Redirect("/Home/Error");
                            return Task.FromResult(0);
                        }
                    }
                });

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });

Can anybody please reply to my issue ?

Thanks

I am having an issue of infinite redirect loop for microsoft active directory login as third party login integration. Here are the steps that I followed

  1. Take module zero sample from github.
  2. Install nuget package Microsoft.Owin.Security.OpenIdConnect version="3.0.1"
  3. Added following code in startup.cs
public class Startup
    {
    private static string clientId = "xxxxxxxxx-xxxx-4d13-a09a-e00c10153a30";
        private static string aadInstance = "https://login.microsoftonline.com/{0}";
        private static string tenant = "xxxxxxxgmail.onmicrosoft.com";
        private static string postLogoutRedirectUri = "http://localhost:6242/";

        public void Configuration(IAppBuilder app)
        {
            string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            app.UseOpenIdConnectAuthentication(
         new OpenIdConnectAuthenticationOptions
         {
             ClientId = clientId,
             Authority = authority,
             PostLogoutRedirectUri = postLogoutRedirectUri,
             Notifications = new OpenIdConnectAuthenticationNotifications
             {
                 AuthenticationFailed = context =>
                 {
                     context.HandleResponse();
                     context.Response.Redirect("/Error?message=" + context.Exception.Message);
                     return Task.FromResult(0);
                 }
             },
             CallbackPath = new PathString("/Account/Login")
         });

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            //app.UseFacebookAuthentication(
            //   appId: "",
            //   appSecret: "");

            //app.UseGoogleAuthentication();
        }
    }
}
}
  1. This app has been registered in windows azure system.

It does take the user to microsoft login screen. User can enter the username and password for windows account. But after that, it got stuck into an infinite loop.

Can you please help me out here ?

Thanks

Showing 1 to 5 of 5 entries