00001: <%@ Page Language="VB" MasterPageFile="~/M2.master" AutoEventWireup="false" CodeFile="admin_user_activate.aspx.vb" Inherits="admin_user_activate" %>
00002: <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
00003: <table><tr><td><asp:TextBox ID="TextBox1" runat="server" Width="300px"></asp:TextBox>
00004: </td><td><asp:Button ID="Button1" runat="server" Text="Проверить" Width="100px" />
00005: </td></tr><tr><td><asp:Label ID="Label1" runat="server"></asp:Label>
00006: </td><td><asp:Button ID="Button2" runat="server" Enabled="False" Text="Активировать" Width="100px" />
00007: </td></tr></table>
00008: </asp:Content>
.....
00001: Partial Class admin_user_activate
00002:     Inherits System.Web.UI.Page
00003:     
00004:     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
00005:         If Not IsPostBack then
00006:             TextBox1.Focus
00007:         End If
00008:     End Sub
00009: 
00010:     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
00011:         Dim U1 As MembershipUser = Membership.GetUser(TextBox1.Text)
00012:         If U1 IsNot Nothing Then
00013:             Button2.Enabled = True
00014:             Label1.Text = U1.ProviderUserKey.ToString
00015:             TextBox1.Enabled = False
00016:             Button1.Enabled = False
00017:         End If
00018:     End Sub
00019: 
00020:     Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
00021:         Dim U1 As MembershipUser = Membership.GetUser(New Guid(Label1.Text))
00022:         Dim MyTypedProfile As New ProfileCommon
00023:         If U1 IsNot Nothing Then
00024:             MyTypedProfile = ProfileBase.Create(TextBox1.Text)
00025:             MyTypedProfile.LoginIsActivate = True
00026:             MyTypedProfile.Save()
00027:             TextBox1.Enabled = True
00028:             Button1.Enabled = True
00029:             Button2.Enabled = False
00030:             Label1.Text = ""
00031:             TextBox1.Text = ""
00032:         End If
00033:     End Sub
00034: 
00035: End Class


Comments ( )
Link to this page: //www.vb-net.com/asp2/35/18.htm
< THANKS ME>