ProTech's home page

ProTech-Online.com

Microsoft c# ASPX code example modify user details webpage.

<%@ Page Title="SANS Secure Code Exercise" Language="VB" MasterPageFile="~/sans.master" AutoEventWireup="false" CodeFile="ModifyUserDetails.aspx.vb" Inherits="admin_ModifyUserDetails" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:Panel ID="PickPanel" runat="server">
        <asp:GridView ID="UserGrid" runat="server" AutoGenerateColumns="False"
        Caption="Select User" DataSourceID="UserDataSource1" DataKeyNames="UserName">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="UserName" HeaderText="UserName"
                SortExpression="UserName" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="UserDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
        SelectCommand="SELECT [UserName] FROM [vw_aspnet_Users]">
    </asp:SqlDataSource>
    </asp:Panel>
    <asp:Panel ID="DetailsPanel" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Change details for user: "></asp:Label>
        <asp:Label ID="UserSelected" runat="server"></asp:Label>
        <br />
        <table border="0">
            <tr>
                <td style="text-align: right">
                    <asp:Label ID="Label3" runat="server" Text="Role:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="UserRole" runat="server" DataSourceID="SqlDataSource1"
                        DataTextField="RoleName" DataValueField="RoleName">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="text-align: right">
                    <asp:Label ID="Label4" runat="server" Text="Credit Card:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="tbCreditCardM" runat="server" Width="221px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                        ControlToValidate="tbCreditCardM" ErrorMessage="Bad Card Number"
                        ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td style="text-align: right">
                    Password:</td>
                <td>
                    <asp:TextBox ID="tbPassword" runat="server" Width="218px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
                                ControlToValidate="tbPassword" ErrorMessage="Password is required."
                                ToolTip="Password is required." ValidationGroup="CreateUserWizard1" >*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
                        ControlToValidate="tbPassword" ErrorMessage="Bad Chars"
                        ValidationExpression="^[^%'\<\>&quot;]*$"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td style="text-align: right">
                    &nbsp;</td>
                <td>
                    <asp:Button ID="Button1" runat="server" Text="Change" />
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                        ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
                        SelectCommand="SELECT [RoleName] FROM [vw_aspnet_Roles]">
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>


Copyright © 2013 ProTechs-Online.com; All rights reserved.