protected void linklogin_Click(object sender, EventArgs e) { DotNetNuke.Security.PortalSecurity users = new DotNetNuke.Security.PortalSecurity(); string username = txtusername.Text.ToString(); string password = txtpassword.Text.ToString(); string portalname = PortalSettings.PortalName.ToString(); int pid = PortalId; int userfound; userfound = users.UserLogin(username.ToString(), password.ToString(), pid, portalname, "127.0.0.1", true); if (userfound == -1) { //lblLoginError.Text = "Invalid username or password"; Page.RegisterClientScriptBlock("!","<script type=\"text/javascript\">alert(\"Username and Password incorrect\");</script>"); } else { string currentpage = Page.Request.Url.AbsoluteUri.ToString(); Response.Redirect(currentpage.ToString()); } }