March 03, 2010

Dynamic Redirect for a User

FormsAuthentication.RedirectFromLoginPage(txtUserName.Text.Trim(), false);
string strUserUrl = "";
SPSecurity.RunWithElevatedPrivileges(delegate
{
SPSite oSite = SPContext.Current.Site;
SPWebCollection collWebs = oSite.OpenWeb().GetSubwebsForCurrentUser();
foreach (SPWeb oWebsite in collWebs)
{
SPUserCollection collUsers = oWebsite.AllUsers;
foreach (SPUser oUser in collUsers)
{
if (oUser.LoginName.ToUpper() == txtUserName.Text.Trim().ToUpper())
{
strUserUrl = oWebsite.ServerRelativeUrl.ToString();
}
}

oWebsite.Dispose();
}
});

Response.Redirect("http://portal/"+strUserUrl,true);

No comments:

SonarQube with Jenkins Setup using Docker Images

https://funnelgarden.com/sonarqube-jenkins-docker/  https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-con...