Krishnan Suba

Krishnan Suba

  • 1.8k
  • 35
  • 1.8k

Public user, how to access the customer site in withoutlogin

Oct 22 2019 8:00 AM
In kentico 10 customer site already used login window, if enter username and password, if credential is success they able to access the customer site. else the credential is not valid not able to access the site.
My requirement is how to access the site in without login window for particular users, not all users.
 
I used below code, again page will redirectiong to login window. How to avoid the login window for particular user not all users?
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
var page = tree.SelectNodes().Path("/").OnCurrentSite().Culture("en-us").FirstObject;
if (page != null) { // Gets the user
UserInfo user = UserInfoProvider.GetUserInfo("username");
if (user != null)
{
if (user.IsAuthorizedPerTreeNode(page, NodePermissionsEnum.Read) == AuthorizationResultEnum.Allowed)
{
Response.Redirect("/getdoc/e47be7b9-3cbf-4fbf-999f-6b67bb20044a/Home.aspx"); * } } }
 

Answers (1)