API Questions on Kentico API.
Version 6.x > API > Integration of Kentico User Authentication in asp.net login form View modes: 
User avatar
Member
Member
aditya.kadam77-gmail - 9/18/2012 12:25:48 AM
   
Integration of Kentico User Authentication in asp.net login form
Hi,
I want to integrate Kentico User Authentication module with my asp.net application login form. Can anyone suggest me the steps to do so..?? Are you guyz providing any plugin to do so..?

Regards,
AK

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 9/18/2012 7:53:13 AM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi,

Basically, you can follow guidelines at http://devnet.kentico.com/docs/6_0/devguide/using_api_and_cms_controls_outside_cms_project.htm

The specifics of the authentication options in Kentico CMS are described in chapter Membership / Authentication.

Hope this helps.
Regards,
Zdenek

User avatar
Member
Member
aditya.kadam77-gmail - 9/20/2012 11:56:24 PM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi,

I have implemented the Kentico CMS.MembershipProvider.CMSMembershipProvider for authenticating the user successfully.
This is my web.config setting
-- Connection string--
<connectionStrings>
<add name="CMSConnectionString" connectionString="Persist Security Info=False;database=COTS_Kentico;server=rxdotnet;user id=dotnet;password=dotnet;Current Language=English;Connection Timeout=240;" />
</connectionStrings>

--App Setting--
<appSettings>
<add key="CMSProgrammingLanguage" value="C#"/>

<add key="CMSApplicationGuid" value="8B01C719-6AAF-4596-9BD8-53EBBB3C74CA"/>
<add key="CMSApplicationName" value="Goodstart"/>
</appSettings>


The problem is that i'm unable to find the role of the user. Below is my membership & role provider setting

<membership defaultProvider="CMSProvider" userIsOnlineTimeWindow="30">
<providers>
<clear/>
<add name="CMSProvider" type="CMS.MembershipProvider.CMSMembershipProvider" connectionStringName="CMSConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed"/>
</providers>
</membership>
<roleManager defaultProvider="CMSRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
<providers>
<clear/>
<add name="CMSRoleProvider" type="CMS.MembershipProvider.CMSRoleProvider" connectionStringName="CMSConnectionString" applicationName="Goodstart" writeExceptionsToEventLog="false"/>
</providers>
</roleManager>

The code CMS.CMSHelper.CMSContext.CurrentSite.SiteName will not provide me the current site name which is obvious ,cos i'm running my sample asp.net application rather than Kentico application.

How I'm I supposed to find the role..??

User avatar
Member
Member
AK - 9/23/2012 11:30:52 PM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi,
Please provide me a solution.

User avatar
Member
Member
AK - 9/24/2012 5:40:10 AM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi.,
Please consider above posted issue for version 6. I have mistakenly posted here.

Regards,
AK

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 9/26/2012 9:31:47 AM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi,

How are you trying to get the User's Role? The UserInfoProvider.GetUserRole method doesn't need the SiteName...

Could you please describe the current issue more specifically? What code are you using to get the Role(s)?

Thank you in advance for information.

Regards,
Zdenek

User avatar
Member
Member
AK - 9/28/2012 1:35:45 AM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi,

I'm just using the registered client site in Kentico database connection strings in web.config to authenticate the user. I'm authenticating the user in my client MVC application to proceed further. Below is my code to get user role

CMSRoleProvider roleName = new CMSRoleProvider();
roleName.GetRolesForUser(model.UserName);

The issue is that i'm not getting the user role.
Regards,
AK

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 9/28/2012 7:06:19 AM
   
RE:Integration of Kentico User Authentication in asp.net login form
Hi,

I would recommend to get the user info in the code behind and use the method like this:
CMS.SiteProvider.UserInfoProvider.GetUserRoles(CMS.SiteProvider.UserInfo)

Best regards,
Martin Danko