window1.xaml.cs
来自「C#高级编程第6版随书源代码 值得下载」· CS 代码 · 共 53 行
CS
53 行
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Web.Security;
using System.Net;
namespace AuthenticationServices
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void buttonLogin_Click(object sender, RoutedEventArgs e)
{
try
{
if (Membership.ValidateUser(textUsername.Text, textPassword.Password))
{
// user validated!
labelValidatedInfo.Visibility = Visibility.Visible;
}
else
{
MessageBox.Show("Username or password not valid", "Client Authentication Services", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
catch (WebException ex)
{
MessageBox.Show(ex.Message, "Client Application Services", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?