Skip to main content
Formatação
Fonte Link
rubStackOverflow
  • 7,5mil
  • 13
  • 44
  • 89

HTML

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="webReport0800net.login" %>

Relatórios CSC- Loginfunction ValidaUsuario(){if(document.getElementById("").value == ""){dhtmlx.message({ type: "error", text: "Login inválido! Favor informar seu ID GR"})//alert("Informe o nome.");document.getElementById("").focus();return false;} else{//REGEX para aceitar apens texto no formado dos IDs da GRSAvar ck_id1 =/^[Ff]{1}[Ee]{1}[Gg]{1}[Rr]{1}\d{4}$/;var ck_id2 =/^[Gg]{1}[Rr]{1}\d{6}$/;var tempNome = document.getElementById("").value;var matchNome1 = tempNome.match(ck_id1);var matchNome2 = tempNome.match(ck_id2);if(matchNome1 == null && matchNome2 == null){dhtmlx.message({ type: "error", text: "ID informado é inválido! Favor informar seu ID GR"})document.getElementById("").focus();return false;}else{if(document.getElementById("").value == ""){dhtmlx.message({ type: "error", text: "Favor digitar a sua senha de rede!"})document.getElementById("").focus();return false;}}}function Erro(){dhtmlx.message({ type: "error", text: "Usuário e/ou senha incorretos!!"})}return true;}body{background-color: #bea879}.div_p{position:absolute;top:13%;left:35%;background-color: #eeece0;width: 350px;-webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);-moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);-moz-border-radius:15px;-box-border-radius:15px;-webkit-border-radius:15px;border-radius:15px;}.div_logo_gr{position:relative;padding-top:5%;padding-left:28%;}.div_text{text-align:center;color:Blue;}.div_form_login{position:relative;padding-top:5%;padding-left:30%;}.modal_loader{position: fixed;z-index: 999;padding-top: 15px;background-color:Transparent;filter: alpha(opacity=60);opacity: 0.6;-moz-opacity: 0.8;}.div_logo_csc{position:relative;padding-left:33%;padding-bottom:5%;}
Relatórios gerenciais CSC. Acesso ao sistemaUse seu ID e senha de rede para o acessoLoginSenha

CODE BEHIND

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; using System.Net;HTML

namespace webReport0800net { public partial class login : System.Web.UI.Page {

 
<%@ Page Language="C#" AutoEventWireup="true" stringCodeBehind="login.aspx.cs" retornoLogon;Inherits="webReport0800net.login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    protected void Page_Load(object sender, EventArgs<title>Relatórios e)CSC - Login</title>
    {    <script src="js/dhtmlx.js" type="text/javascript"></script>
        if<link (!IsPostBack)href="css/dhtmlx.css" rel="stylesheet" type="text/css" />
        <link href="css/roboto.css" rel="stylesheet" type="text/css" />
        <script language="javascript" type="text/javascript">
            function ValidaUsuario() {
            usuTextBox.Text = string  if (document.Empty;getElementById("<%=usuTextBox.ClientID%>").value == "") {
            senhaTextBox.Text = string      dhtmlx.Empty;
message(
        }
                { type: "error", text: "Login inválido! Favor informar seu ID GR" }
 
    protected void validaButton_Click(object sender, EventArgs e           )
    {
        string adPath = "LDAP://DC=gr,DC=sa";     //Pathalert("Informe too yournome.");
 LDAP directory server
        LdapAuthentication adAuth = new LdapAuthentication     document.getElementById(adPath"<%=usuTextBox.ClientID%>").focus();
        try            return false;
                } else {
            retornoLogon = adAuth.IsAuthenticated("gr.sa", usuTextBox.Text, senhaTextBox.Text);    //REGEX para aceitar apens texto no formado dos IDs da GRSA
            if(!retornoLogon.Contains("Ocorreu") || !retornoLogon.Contains("Erro"))      var ck_id1 = /^[Ff]{1}[Ee]{1}[Gg]{1}[Rr]{1}\d{4}$/;
                    var ck_id2 = /^[Gg]{1}[Rr]{1}\d{6}$/;
                string groups   var tempNome = adAuthdocument.GetGroupsgetElementById("<%=usuTextBox.ClientID%>");
.value;
                //Create the ticket, and addvar thematchNome1 groups= tempNome.match(ck_id1);
                bool isCookiePersistent   var matchNome2 = lembrarUsuarioCheckBoxtempNome.Checked;match(ck_id2);
                FormsAuthenticationTicket authTicket = new FormsAuthenticationTicketif (1,
matchNome1 == null && matchNome2 == null) {
                   usuTextBox.Text, DateTime.Now, DateTime.Now   dhtmlx.AddMinutesmessage(60), 
 isCookiePersistent                           { type: "error", groups);
text: "ID informado é inválido! Favor informar seu ID GR" }
                //Encrypt the ticket.      )
                string encryptedTicket = FormsAuthentication     document.EncryptgetElementById(authTicket"<%=usuTextBox.ClientID %>").focus();
 
                //Create a cookie, and then add the encrypted ticketreturn tofalse;
 the cookie as data.                }
                HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName,else encryptedTicket);
{
                        if (truedocument.getElementById("<%=senhaTextBox.ClientID%>").value == isCookiePersistent"") {
                    authCookie.Expires = authTicket      dhtmlx.Expiration;message(
                                { type: "error", text: "Favor digitar a sua senha de rede!" }
                //Add the cookie to the outgoing cookies collection.     )
                Response            document.CookiesgetElementById("<%=senhaTextBox.AddClientID%>").focus(authCookie);
 
                //You can redirect now.
          return false;
     if (Request.QueryString["ReturnUrl"] != null)
                {}
                    Response.Redirect(FormsAuthentication.GetRedirectUrl(usuTextBox.Text, false));}
                }
                else
                {
                    System.Threading.Thread.Sleep(5000);
                    //PerfilClass.MyLogin =function usuTextBox.Text.ToString().ToUpperErro();
                    //PerfilClass.MyNome = retornoLogon.ToString().ToUpper();{
                    //PerfilClass.MyHost = Environment.MachineName.ToString()dhtmlx.ToUppermessage();
                    //foreach (var item in Dns.GetHostAddresses(Environment.MachineName))
                    //{
                    //    iftype: (item.ToString().Substring(0"error",3) == "172")
                    //    {
                    //        PerfilClass.MyIP = item.ToString();
                    //        break;
                  text: "Usuário /e/ ou senha incorretos!!" }
                    //}
                    //Response.Redirect("~/menu.aspx");
                    return;}
                }return true;
            }
        }    
        catch</script> (Exception ex)  
        <style type="text/css">
            body
            {
            //Já tentei todas linhas abaixobackground-color: mas#bea879
 não funciona          }
             .div_p
            //Quando{
 debugo as linhas são interpretadas sem error         position:absolute;
            ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$ top:13%;
                left:35%;
                background-color: #eeece0;
                width: 350px;
                -webkit-box-shadow: 10px 10px 5px 0px rgba(document)0,0,0,0.ready(function(){EnableControls(75);alert('Overrides;
 successfully Updated              -moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.'75);DisableControls;
                -box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
                -moz-border-radius:15px;
                -box-border-radius:15px;
                -webkit-border-radius:15px;
                 border-radius:15px;
                
            });", 
 true);           .div_logo_gr
            ScriptManager{
               position:relative;
               padding-top:5%;
               padding-left:28%;
            }
            .RegisterClientScriptBlock(Page,div_text
 Page           {
                text-align:center;
                color:Blue;
            }
            .GetType(),div_form_login
 "mensagem", "Erro()", true         {
               position:relative;
               padding-top:5%;
               padding-left:30%;
            }
            .modal_loader
            {
                position: fixed;
                z-index: 999;
                padding-top: 15px;
                background-color:Transparent;
                filter: alpha(opacity=60);
            ClientScript    opacity: 0.RegisterClientScriptBlock(this6;
                -moz-opacity: 0.GetType(),8;
 "showmessagebox", "Erro();", true);         }
            Page.ClientScriptdiv_logo_csc
            {
               position:relative;
               padding-left:33%;
               padding-bottom:5%;
            }
        </style>
    </head>
    <body>
        <div class=div_p>
            <div class=div_logo_gr>
                <img src="img/logo-gr-compass.RegisterStartupScript(thisjpg" />
            </div>
            <br />
            <div class=div_text>
                Relatórios gerenciais CSC.GetType(),"Erro", "ErroAcesso ao sistema
            </div>
            <div class=div_text>
                Use seu ID e senha de rede para o acesso
            </div>
            <div class=div_form_login>
                <form id="login" runat="server">
                    <asp:ScriptManager ID="loginFormScriptManager" EnablePageMethods="true" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdateProgress ID="loginFormUpdateProgress" runat="server" AssociatedUpdatePanelID="loginFormUpdatePanel">
                        <ProgressTemplate>
                            <div class=modal_loader>
                                <div class="center">
                                    <img alt="" src="img/loader.gif" />
                                </div>
                            </div>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <div>
                        <asp:UpdatePanel ID="loginFormUpdatePanel" runat="server">
                            <ContentTemplate>
                                <div>
                                    <b>Login</b>
                                </div>
                                <div>
                                    <asp:TextBox ID="usuTextBox" runat="server"></asp:TextBox>
                                </div>
                                <div style="margin-top:7px;">
                                    <b>Senha</b>
                                </div>
                                <div>
                                    <asp:TextBox ID="senhaTextBox" runat="server" TextMode="Password"></asp:TextBox>
                                </div>
                                <div style="margin-top:7px;">
                                    <asp:CheckBox ID="lembrarUsuarioCheckBox" runat="server" Font-Bold="True" 
                                        Text="Lembrar Usuário / Senha" />
                                </div>
                                <div style="margin-top:7px;">
                                        <asp:Button ID="validaButton" runat="server" Text="Acessar" 
                                            OnClientClick=" return ValidaUsuario();"," true);onclick="validaButton_Click" />
                                </div>
        }                    </ContentTemplate>
    }                    </asp:UpdatePanel>
}                    
                        
                    </div>
                </form>
            </div>
            <br />
            <div class=div_logo_csc>
                <img src="img/logo_csc.jpg" />
            </div>
        </div>
    </body>
</html>

}CODE BEHIND


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Net;

namespace webReport0800net
{
    public partial class login : System.Web.UI.Page
    {

        string retornoLogon;


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                usuTextBox.Text = string.Empty;
                senhaTextBox.Text = string.Empty;

            }
        }

        protected void validaButton_Click(object sender, EventArgs e)
        {
            string adPath = "LDAP://DC=gr,DC=sa"; //Path to your LDAP directory server
            LdapAuthentication adAuth = new LdapAuthentication(adPath);
            try
            {
                retornoLogon = adAuth.IsAuthenticated("gr.sa", usuTextBox.Text, senhaTextBox.Text);
                if(!retornoLogon.Contains("Ocorreu") || !retornoLogon.Contains("Erro"))
                {
                    string groups = adAuth.GetGroups();

                    //Create the ticket, and add the groups.
                    bool isCookiePersistent = lembrarUsuarioCheckBox.Checked;
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
                              usuTextBox.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups);

                    //Encrypt the ticket.
                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);

                    //Create a cookie, and then add the encrypted ticket to the cookie as data.
                    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);

                    if (true == isCookiePersistent)
                        authCookie.Expires = authTicket.Expiration;

                    //Add the cookie to the outgoing cookies collection.
                    Response.Cookies.Add(authCookie);

                    //You can redirect now.
                    if (Request.QueryString["ReturnUrl"] != null)
                    {
                        Response.Redirect(FormsAuthentication.GetRedirectUrl(usuTextBox.Text, false));
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(5000);
                        //PerfilClass.MyLogin = usuTextBox.Text.ToString().ToUpper();
                        //PerfilClass.MyNome = retornoLogon.ToString().ToUpper();
                        //PerfilClass.MyHost = Environment.MachineName.ToString().ToUpper();
                        //foreach (var item in Dns.GetHostAddresses(Environment.MachineName))
                        //{
                        //    if (item.ToString().Substring(0,3) == "172")
                        //    {
                        //        PerfilClass.MyIP = item.ToString();
                        //        break;
                        //    }
                        //}
                        //Response.Redirect("~/menu.aspx");
                        return;
                    } 
                }
            }
            catch (Exception ex)
            {
                //Já tentei todas linhas abaixo mas não funciona.
                //Quando debugo as linhas são interpretadas sem error
                ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$(document).ready(function(){EnableControls();alert('Overrides successfully Updated.');DisableControls();});", true);
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "mensagem", "Erro()", true);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "showmessagebox", "Erro();", true);
                Page.ClientScript.RegisterStartupScript(this.GetType(),"Erro", "Erro();", true);

            }
        }
    }
}

HTML

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="webReport0800net.login" %>

Relatórios CSC- Loginfunction ValidaUsuario(){if(document.getElementById("").value == ""){dhtmlx.message({ type: "error", text: "Login inválido! Favor informar seu ID GR"})//alert("Informe o nome.");document.getElementById("").focus();return false;} else{//REGEX para aceitar apens texto no formado dos IDs da GRSAvar ck_id1 =/^[Ff]{1}[Ee]{1}[Gg]{1}[Rr]{1}\d{4}$/;var ck_id2 =/^[Gg]{1}[Rr]{1}\d{6}$/;var tempNome = document.getElementById("").value;var matchNome1 = tempNome.match(ck_id1);var matchNome2 = tempNome.match(ck_id2);if(matchNome1 == null && matchNome2 == null){dhtmlx.message({ type: "error", text: "ID informado é inválido! Favor informar seu ID GR"})document.getElementById("").focus();return false;}else{if(document.getElementById("").value == ""){dhtmlx.message({ type: "error", text: "Favor digitar a sua senha de rede!"})document.getElementById("").focus();return false;}}}function Erro(){dhtmlx.message({ type: "error", text: "Usuário e/ou senha incorretos!!"})}return true;}body{background-color: #bea879}.div_p{position:absolute;top:13%;left:35%;background-color: #eeece0;width: 350px;-webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);-moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);-moz-border-radius:15px;-box-border-radius:15px;-webkit-border-radius:15px;border-radius:15px;}.div_logo_gr{position:relative;padding-top:5%;padding-left:28%;}.div_text{text-align:center;color:Blue;}.div_form_login{position:relative;padding-top:5%;padding-left:30%;}.modal_loader{position: fixed;z-index: 999;padding-top: 15px;background-color:Transparent;filter: alpha(opacity=60);opacity: 0.6;-moz-opacity: 0.8;}.div_logo_csc{position:relative;padding-left:33%;padding-bottom:5%;}
Relatórios gerenciais CSC. Acesso ao sistemaUse seu ID e senha de rede para o acessoLoginSenha

CODE BEHIND

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; using System.Net;

namespace webReport0800net { public partial class login : System.Web.UI.Page {

    string retornoLogon;


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            usuTextBox.Text = string.Empty;
            senhaTextBox.Text = string.Empty;

        }
    }
 
    protected void validaButton_Click(object sender, EventArgs e)
    {
        string adPath = "LDAP://DC=gr,DC=sa"; //Path to your LDAP directory server
        LdapAuthentication adAuth = new LdapAuthentication(adPath);
        try
        {
            retornoLogon = adAuth.IsAuthenticated("gr.sa", usuTextBox.Text, senhaTextBox.Text);
            if(!retornoLogon.Contains("Ocorreu") || !retornoLogon.Contains("Erro"))
            {
                string groups = adAuth.GetGroups();

                //Create the ticket, and add the groups.
                bool isCookiePersistent = lembrarUsuarioCheckBox.Checked;
                FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
                          usuTextBox.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups);

                //Encrypt the ticket.
                string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
 
                //Create a cookie, and then add the encrypted ticket to the cookie as data.
                HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);

                if (true == isCookiePersistent)
                    authCookie.Expires = authTicket.Expiration;

                //Add the cookie to the outgoing cookies collection.
                Response.Cookies.Add(authCookie);
 
                //You can redirect now.
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    Response.Redirect(FormsAuthentication.GetRedirectUrl(usuTextBox.Text, false));
                }
                else
                {
                    System.Threading.Thread.Sleep(5000);
                    //PerfilClass.MyLogin = usuTextBox.Text.ToString().ToUpper();
                    //PerfilClass.MyNome = retornoLogon.ToString().ToUpper();
                    //PerfilClass.MyHost = Environment.MachineName.ToString().ToUpper();
                    //foreach (var item in Dns.GetHostAddresses(Environment.MachineName))
                    //{
                    //    if (item.ToString().Substring(0,3) == "172")
                    //    {
                    //        PerfilClass.MyIP = item.ToString();
                    //        break;
                    //    }
                    //}
                    //Response.Redirect("~/menu.aspx");
                    return;
                } 
            }
        }
        catch (Exception ex)
        {
            //Já tentei todas linhas abaixo mas não funciona.
            //Quando debugo as linhas são interpretadas sem error
            ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$(document).ready(function(){EnableControls();alert('Overrides successfully Updated.');DisableControls();});", true);
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "mensagem", "Erro()", true);
            ClientScript.RegisterClientScriptBlock(this.GetType(), "showmessagebox", "Erro();", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(),"Erro", "Erro();", true);

        }
    }
}

}

HTML

 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="webReport0800net.login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Relatórios CSC - Login</title>
        <script src="js/dhtmlx.js" type="text/javascript"></script>
        <link href="css/dhtmlx.css" rel="stylesheet" type="text/css" />
        <link href="css/roboto.css" rel="stylesheet" type="text/css" />
        <script language="javascript" type="text/javascript">
            function ValidaUsuario() {
                if (document.getElementById("<%=usuTextBox.ClientID%>").value == "") {
                    dhtmlx.message(
                        { type: "error", text: "Login inválido! Favor informar seu ID GR" }
                    )
                    //alert("Informe o nome.");
                    document.getElementById("<%=usuTextBox.ClientID%>").focus();
                    return false;
                } else {
                    //REGEX para aceitar apens texto no formado dos IDs da GRSA
                    var ck_id1 = /^[Ff]{1}[Ee]{1}[Gg]{1}[Rr]{1}\d{4}$/;
                    var ck_id2 = /^[Gg]{1}[Rr]{1}\d{6}$/;
                    var tempNome = document.getElementById("<%=usuTextBox.ClientID%>").value;
                    var matchNome1 = tempNome.match(ck_id1);
                    var matchNome2 = tempNome.match(ck_id2);
                    if (matchNome1 == null && matchNome2 == null) {
                        dhtmlx.message( 
                            { type: "error", text: "ID informado é inválido! Favor informar seu ID GR" }
                        )
                        document.getElementById("<%=usuTextBox.ClientID %>").focus();
                        return false;
                    }
                    else {
                        if (document.getElementById("<%=senhaTextBox.ClientID%>").value == "") {
                            dhtmlx.message(
                                { type: "error", text: "Favor digitar a sua senha de rede!" }
                            )
                            document.getElementById("<%=senhaTextBox.ClientID%>").focus();
                            return false;
                        }
                    }
                }
                function Erro() {
                    dhtmlx.message(
                                { type: "error", text: "Usuário e/ou senha incorretos!!" }
                            )
                }
                return true;
            }
            
        </script>    
        <style type="text/css">
            body
            {
                background-color: #bea879
            }
             .div_p
            {
                position:absolute;
                top:13%;
                left:35%;
                background-color: #eeece0;
                width: 350px;
                -webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
                -moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
                -box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
                -moz-border-radius:15px;
                -box-border-radius:15px;
                -webkit-border-radius:15px;
                 border-radius:15px;
                
            } 
            .div_logo_gr
            {
               position:relative;
               padding-top:5%;
               padding-left:28%;
            }
            .div_text
            {
                text-align:center;
                color:Blue;
            }
            .div_form_login
            {
               position:relative;
               padding-top:5%;
               padding-left:30%;
            }
            .modal_loader
            {
                position: fixed;
                z-index: 999;
                padding-top: 15px;
                background-color:Transparent;
                filter: alpha(opacity=60);
                opacity: 0.6;
                -moz-opacity: 0.8;
            }
            .div_logo_csc
            {
               position:relative;
               padding-left:33%;
               padding-bottom:5%;
            }
        </style>
    </head>
    <body>
        <div class=div_p>
            <div class=div_logo_gr>
                <img src="img/logo-gr-compass.jpg" />
            </div>
            <br />
            <div class=div_text>
                Relatórios gerenciais CSC. Acesso ao sistema
            </div>
            <div class=div_text>
                Use seu ID e senha de rede para o acesso
            </div>
            <div class=div_form_login>
                <form id="login" runat="server">
                    <asp:ScriptManager ID="loginFormScriptManager" EnablePageMethods="true" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdateProgress ID="loginFormUpdateProgress" runat="server" AssociatedUpdatePanelID="loginFormUpdatePanel">
                        <ProgressTemplate>
                            <div class=modal_loader>
                                <div class="center">
                                    <img alt="" src="img/loader.gif" />
                                </div>
                            </div>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <div>
                        <asp:UpdatePanel ID="loginFormUpdatePanel" runat="server">
                            <ContentTemplate>
                                <div>
                                    <b>Login</b>
                                </div>
                                <div>
                                    <asp:TextBox ID="usuTextBox" runat="server"></asp:TextBox>
                                </div>
                                <div style="margin-top:7px;">
                                    <b>Senha</b>
                                </div>
                                <div>
                                    <asp:TextBox ID="senhaTextBox" runat="server" TextMode="Password"></asp:TextBox>
                                </div>
                                <div style="margin-top:7px;">
                                    <asp:CheckBox ID="lembrarUsuarioCheckBox" runat="server" Font-Bold="True" 
                                        Text="Lembrar Usuário / Senha" />
                                </div>
                                <div style="margin-top:7px;">
                                        <asp:Button ID="validaButton" runat="server" Text="Acessar" 
                                            OnClientClick=" return ValidaUsuario()" onclick="validaButton_Click" />
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    
                        
                    </div>
                </form>
            </div>
            <br />
            <div class=div_logo_csc>
                <img src="img/logo_csc.jpg" />
            </div>
        </div>
    </body>
</html>

CODE BEHIND


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Net;

namespace webReport0800net
{
    public partial class login : System.Web.UI.Page
    {

        string retornoLogon;


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                usuTextBox.Text = string.Empty;
                senhaTextBox.Text = string.Empty;

            }
        }

        protected void validaButton_Click(object sender, EventArgs e)
        {
            string adPath = "LDAP://DC=gr,DC=sa"; //Path to your LDAP directory server
            LdapAuthentication adAuth = new LdapAuthentication(adPath);
            try
            {
                retornoLogon = adAuth.IsAuthenticated("gr.sa", usuTextBox.Text, senhaTextBox.Text);
                if(!retornoLogon.Contains("Ocorreu") || !retornoLogon.Contains("Erro"))
                {
                    string groups = adAuth.GetGroups();

                    //Create the ticket, and add the groups.
                    bool isCookiePersistent = lembrarUsuarioCheckBox.Checked;
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
                              usuTextBox.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups);

                    //Encrypt the ticket.
                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);

                    //Create a cookie, and then add the encrypted ticket to the cookie as data.
                    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);

                    if (true == isCookiePersistent)
                        authCookie.Expires = authTicket.Expiration;

                    //Add the cookie to the outgoing cookies collection.
                    Response.Cookies.Add(authCookie);

                    //You can redirect now.
                    if (Request.QueryString["ReturnUrl"] != null)
                    {
                        Response.Redirect(FormsAuthentication.GetRedirectUrl(usuTextBox.Text, false));
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(5000);
                        //PerfilClass.MyLogin = usuTextBox.Text.ToString().ToUpper();
                        //PerfilClass.MyNome = retornoLogon.ToString().ToUpper();
                        //PerfilClass.MyHost = Environment.MachineName.ToString().ToUpper();
                        //foreach (var item in Dns.GetHostAddresses(Environment.MachineName))
                        //{
                        //    if (item.ToString().Substring(0,3) == "172")
                        //    {
                        //        PerfilClass.MyIP = item.ToString();
                        //        break;
                        //    }
                        //}
                        //Response.Redirect("~/menu.aspx");
                        return;
                    } 
                }
            }
            catch (Exception ex)
            {
                //Já tentei todas linhas abaixo mas não funciona.
                //Quando debugo as linhas são interpretadas sem error
                ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$(document).ready(function(){EnableControls();alert('Overrides successfully Updated.');DisableControls();});", true);
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "mensagem", "Erro()", true);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "showmessagebox", "Erro();", true);
                Page.ClientScript.RegisterStartupScript(this.GetType(),"Erro", "Erro();", true);

            }
        }
    }
}
Fonte Link

aps.net não chama javascript no code behind

gostaria de chamar de meu código uma função em javascript que encontra-se no meu html. Segue abaixo meus códigos

HTML

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="webReport0800net.login" %>

Relatórios CSC - Login function ValidaUsuario() { if (document.getElementById("").value == "") { dhtmlx.message( { type: "error", text: "Login inválido! Favor informar seu ID GR" } ) //alert("Informe o nome."); document.getElementById("").focus(); return false; } else { //REGEX para aceitar apens texto no formado dos IDs da GRSA var ck_id1 = /^[Ff]{1}[Ee]{1}[Gg]{1}[Rr]{1}\d{4}$/; var ck_id2 = /^[Gg]{1}[Rr]{1}\d{6}$/; var tempNome = document.getElementById("").value; var matchNome1 = tempNome.match(ck_id1); var matchNome2 = tempNome.match(ck_id2); if (matchNome1 == null && matchNome2 == null) { dhtmlx.message( { type: "error", text: "ID informado é inválido! Favor informar seu ID GR" } ) document.getElementById("").focus(); return false; } else { if (document.getElementById("").value == "") { dhtmlx.message( { type: "error", text: "Favor digitar a sua senha de rede!" } ) document.getElementById("").focus(); return false; } } } function Erro() { dhtmlx.message( { type: "error", text: "Usuário e/ou senha incorretos!!" } ) } return true; } body { background-color: #bea879 } .div_p { position:absolute; top:13%; left:35%; background-color: #eeece0; width: 350px; -webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75); -moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75); -box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75); -moz-border-radius:15px; -box-border-radius:15px; -webkit-border-radius:15px; border-radius:15px; } .div_logo_gr { position:relative; padding-top:5%; padding-left:28%; } .div_text { text-align:center; color:Blue; } .div_form_login { position:relative; padding-top:5%; padding-left:30%; } .modal_loader { position: fixed; z-index: 999; padding-top: 15px; background-color:Transparent; filter: alpha(opacity=60); opacity: 0.6; -moz-opacity: 0.8; } .div_logo_csc { position:relative; padding-left:33%; padding-bottom:5%; }
Relatórios gerenciais CSC. Acesso ao sistema Use seu ID e senha de rede para o acesso Login Senha

CODE BEHIND

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; using System.Net;

namespace webReport0800net { public partial class login : System.Web.UI.Page {

    string retornoLogon;


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            usuTextBox.Text = string.Empty;
            senhaTextBox.Text = string.Empty;

        }
    }

    protected void validaButton_Click(object sender, EventArgs e)
    {
        string adPath = "LDAP://DC=gr,DC=sa"; //Path to your LDAP directory server
        LdapAuthentication adAuth = new LdapAuthentication(adPath);
        try
        {
            retornoLogon = adAuth.IsAuthenticated("gr.sa", usuTextBox.Text, senhaTextBox.Text);
            if(!retornoLogon.Contains("Ocorreu") || !retornoLogon.Contains("Erro"))
            {
                string groups = adAuth.GetGroups();

                //Create the ticket, and add the groups.
                bool isCookiePersistent = lembrarUsuarioCheckBox.Checked;
                FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
                          usuTextBox.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups);

                //Encrypt the ticket.
                string encryptedTicket = FormsAuthentication.Encrypt(authTicket);

                //Create a cookie, and then add the encrypted ticket to the cookie as data.
                HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);

                if (true == isCookiePersistent)
                    authCookie.Expires = authTicket.Expiration;

                //Add the cookie to the outgoing cookies collection.
                Response.Cookies.Add(authCookie);

                //You can redirect now.
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    Response.Redirect(FormsAuthentication.GetRedirectUrl(usuTextBox.Text, false));
                }
                else
                {
                    System.Threading.Thread.Sleep(5000);
                    //PerfilClass.MyLogin = usuTextBox.Text.ToString().ToUpper();
                    //PerfilClass.MyNome = retornoLogon.ToString().ToUpper();
                    //PerfilClass.MyHost = Environment.MachineName.ToString().ToUpper();
                    //foreach (var item in Dns.GetHostAddresses(Environment.MachineName))
                    //{
                    //    if (item.ToString().Substring(0,3) == "172")
                    //    {
                    //        PerfilClass.MyIP = item.ToString();
                    //        break;
                    //    }
                    //}
                    //Response.Redirect("~/menu.aspx");
                    return;
                } 
            }
        }
        catch (Exception ex)
        {
            //Já tentei todas linhas abaixo mas não funciona.
            //Quando debugo as linhas são interpretadas sem error
            ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "$(document).ready(function(){EnableControls();alert('Overrides successfully Updated.');DisableControls();});", true);
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "mensagem", "Erro()", true);
            ClientScript.RegisterClientScriptBlock(this.GetType(), "showmessagebox", "Erro();", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(),"Erro", "Erro();", true);

        }
    }
}

}