Form Login base VB.NET

« Older   Newer »
 
  Share  
.
  1. White.Wolf
        +1   -1
     
    .

    User deleted


    QUI SOTTO VI DO' TUTTE LE COMPONENTI DI UN BANALE FORM DI LOGIN+PAGINA SCRITTO IN VB.NET (COMPONENTE DI PAGINA ASP.NET) Per farlo funzionare è necessario avere Visual Basic 2005/2008+ e un WebServer (IIS ;APACHE+componente che legge asp;Oracle ed altri database mysql)
    Poichè l'intero codice richiama ADO.NET & Componenti che richiedono una risposta al server (runat="server" )


    COMPONENTE PRIMARIA : codice d'origine della pagina login.aspx
    HTML
    <body bgcolor="#ffffff">
    <form id="form1" runat="server">
    <div class="login">
    <table>
    <tr>
    <td>
    <asp:Label ID="Label1" runat="server" Text="Utente:"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="txtUtente" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>
    <asp:Label ID="Label2" runat="server" Text="Password:"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>

    <asp:Label ID="lblerrore" runat="server" Text=""></asp:Label>
    </td>
    <td>
    <asp:Button ID="btnAccedi" runat="server" Text="Accedi" BackColor="White"
    BorderWidth="1px" cssclass="pulsante"
    />







    </td>
    </tr>
    </table>

    <div>
    </form>
    </body>
    </html>


    COMPONENTE SECONDARIA: (codice .vb della pagina login.aspx)

    HTML
    Partial Class login
    Inherits System.Web.UI.Page





















    Protected Sub btnAccedi_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAccedi.Click

    Dim utente As String
    Dim password As String

    utente = txtUtente.Text
    password = txtPassword.Text

    If utente = "pippo" And password = "pluto" Then


    Response.Redirect("Default.aspx")
    Else
    lblerrore.text = "Errore"
    End If








    End Sub
    End Class


    E QUI C'E' IL TUTTO PER COMPORRE IL LOGIN.
    COMPONETE LA PAGINA Default.aspx COME MEGLIO VOLETE ,il form di login vi reindirizzerà a quella pagina.
    POTETE CAMBIARE I CAMPI DEL LOGIN QUA:
    HTML
    If utente = "pippo" And password = "pluto" Then


    E QUA:
    HTML
    Response.Redirect("Default.aspx")

    QUI INVECE POTETE CAMBIARE IL VALORE "Default.aspx" RINOMINANDO DEFAULT A PIACERE COMUNQUE DEVE ESSERE UGUALE ALLA PAGINA A CUI COLLEGHERETE IL FORM DI LOGIN ,IO QUI SOTTO VI POSTO UNA MIA PAGINA DI DEFAULT.ASPX DI PROVA FATTA PER LA SCUOLA:

    COMPONENTE PRIMARIA (codice d'origine della pagina.aspx)
    HTML
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <!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></title>
    <link href="css/segnalazioni.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <form id="form1" runat="server">
    <div class="wrap">
    <table class="tabellaconbordi">
    <tr>
    <td>
    <img src="http://www.ideaprodottomercato.it/images/pagine/logo-assocam.gif" />
    </td>
    <td class="grassetto">
    SEGNALAZIONE ANOMALIE FUNZIONALI AULE E/O LAVORATORII
    </td>
    </tr>
    <tr>
    <td colspan="2" class="adestra">
    segnalazione n°<asp:TextBox ID="TextBox1" runat="server" Width="50px"></asp:TextBox>(a
    cura Resp. SG)
    </td>
    </tr>
    <tr>
    <td colspan="2">
    Data
    <asp:TextBox ID="TextBox2" runat="server" Width="50px"></asp:TextBox>
    </td>
    </tr>
    </tr>
    <tr>
    <td colspan="2">
    Docente
    <asp:TextBox ID="TextBox3" runat="server" Width="248px"></asp:TextBox>

    </td>
    </tr>
    <tr>
    <td colspan="2">
    Aula/Lab. interessato
    <asp:TextBox ID="TextBox4" runat="server" Width="272px"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td colspan="2" class="grassetto">
    ANOMALIA RISCONTRATA
    </td>
    </tr>
    <tr>
    <td colspan="2">
    Anomalie di funzionamento macchine/impianti/attrezzature:
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <asp:TextBox ID="TextBox5" runat="server" TextMode="MultiLine" Height="160px" Width="610px"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    Anomalie riguardanti gli standard di sicurezza:
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <asp:TextBox ID="TextBox6" runat="server" TextMode="MultiLine" Height="160px" Width="605px"></asp:TextBox>
    </td>
    </tr>
    <td colspan="2" class="adestra">
    (Il Docente)
    <asp:TextBox ID="TextBox11" runat="server" Width="50px"></asp:TextBox>(Il Coord. del corso)
    <asp:TextBox ID="TextBox12" runat="server" Width="50px"></asp:TextBox>
    </td>

    <tr>
    <td colspan="2" class="grassetto" align="center">
    A cura del Funz. Servizi Generali
    </td>
    </tr>
    <tr>
    <td colspan="2" class="grassetto">
    Correzione individuata:
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <asp:TextBox ID="TextBox7" runat="server" TextMode="MultiLine" Height="160px" Width="610px"></asp:TextBox>
    </td>
    </tr>
    <tr>

    <td colspan="1">
    Data
    <asp:TextBox ID="TextBox8" runat="server" Width="50px"></asp:TextBox>
    </td>
    <td colspan="1" class="adestra">
    (Il Resp. SG)
    <asp:TextBox ID="TextBox9" runat="server" Width="50px"></asp:TextBox>(Il Resp. SPP)
    <asp:TextBox ID="TextBox10" runat="server" Width="50px"></asp:TextBox>
    </td>

    </tr>
    <tr>
    <td colspan="1">
    <asp:CheckBox ID="CheckBox1" runat="server" /> Chiuso in data
    <asp:TextBox ID="TextBox13" runat="server" Width="50px"></asp:TextBox>
    </td>
    <td colspan="1" class="adestra">
    (Il Resp. SG)
    <asp:TextBox ID="TextBox14" runat="server" Width="50px"></asp:TextBox>
    </td>

    </tr>
    </table>
    </div>
    </form>
    </body>

    </html>


    COMPONENTE .VB
    HTML
    Partial Class _Default
    Inherits System.Web.UI.Page

    End Class
     
    Top
    .
  2.     +1   -1
     
    .
    Avatar

    Senior Member

    Group
    Administrator
    Posts
    16,061
    Reputation
    +93
    Location
    Woodstock

    Status
    Anonymous
    L'hai scritto tu questo codice?
     
    Top
    .
  3. White.Wolf
        +1   -1
     
    .

    User deleted


    Si ai tempi del corso
     
    Top
    .
2 replies since 12/8/2013, 15:58   110 views
  Share  
.