Kentico web site return "500 Internal server error"

Igor Pysanka asked on July 16, 2015 12:50


I faced with the issue related to Salesforce authentication.

I created RegisterExternal.aspx page. Initially, it was working fine. After that I implemented Startup class for using OWIN Forms authentication and added functionality for Salesforce Authentication.

 var options = new SalesforceAuthenticationOptions
                ClientId = "3MVG9Rd3qC6oMalUZqTwm99NdvhlUDPFPWsTfpukRXbcAUnjfAVy0A9P8cwui8g5f39CbMklZ7u34vKOU.dzT",
                ClientSecret = "1826305372233226616",
                Caption = "LogIn by SalesForce",
                CallbackPath = new PathString("/RegisterExternal.aspx"),
                AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive,
                Endpoints = new SalesforceAuthenticationOptions.SalesforceAuthenticationEndpoints
                    AuthorizationEndpoint = "",
                    TokenEndpoint = ""
                Provider = new SalesforceAuthenticationProvider
                    OnAuthenticated = async context =>
                        // Retrieve the OAuth access token to store for subsequent API calls
                        string accessToken = context.AccessToken;

                        // Retrieve the user ID
                        string salesforceUserId = context.UserId;

                        // Retrieve the user's Organization ID
                        string salesforceOrganizationId = context.OrganizationId;

                        // Retrieve the user's full name
                        string salesforceFullName = context.DisplayName;

                        // You can even retrieve the full JSON-serialized user
                        var serializedUser = context.User;

After that when I try to open RegisterExternal.aspx I get the 500 error. If I change or remove CallbackPath I can open RegisterExternal.aspx again.

Could you help me with this iisue?

Recent Answers

Roman Hutnyk answered on July 17, 2015 22:10

Здоровенькі були, Igor!

I'd recommend you to review Kentico documentation on custom authentication topic:

It looks like you're trying to implement you authentication page, but Kentico recommends you to use their form, but handle SecurityEvents.Authenticate.Execute event where you can verify user creds against third party system and fetch some user data if it is valid.

Hope this helps a bit.

0 votesVote for this answer Mark as a Correct answer

Igor Pysanka answered on July 20, 2015 10:24

I Вам доброго дня :-)

Thank you for answer but I forgot that I used Kentico 7. So I can't use this solution. Kentico 7 doesn't have SecurityEvents like as Kentico 8

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on July 20, 2015 15:45


Please see this. It describes similar approach but for 7th version.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.