⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setupauthentication.aspx

📁 《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含的源代码.非常经典的一本asp.net2.0的书籍
💻 ASPX
字号:
<%@ Page masterPageFile="~/WebAdminButtonRow.master" trace="false" inherits="System.Web.Administration.SecurityPage"%>
<%@ Import Namespace="System.Web.Configuration" %>

<script runat="server" language="cs">
public void Page_Load() {
    if (!IsPostBack) {
        Configuration config = OpenWebConfiguration(ApplicationPath);
        AuthenticationSection auth = (AuthenticationSection) config.GetSection("system.web/authentication");
        if (auth.Mode == AuthenticationMode.Windows) {
            fromInternet.Checked = false;
            fromNetwork.Checked = true;
        }
    }
}

public void UpdateAndReturnToPreviousPage(object sender, EventArgs e) {
    Configuration config = OpenWebConfiguration(ApplicationPath);
    AuthenticationSection auth = (AuthenticationSection) config.GetSection("system.web/authentication");
    auth.Mode = fromInternet.Checked ? AuthenticationMode.Forms : AuthenticationMode.Windows;
    SaveConfig(config);
    Response.Write(auth.Mode);
    ReturnToPreviousPage(sender, e);
}

</script>
<asp:content runat="server" contentplaceholderid="titleBar"/>

<asp:content runat="server" contentplaceholderid="buttons">
    <asp:button ValidationGroup="none" runat="server" id="button1" text="<%$ Resources:DoneButton %>" onclick="UpdateAndReturnToPreviousPage"/>
</asp:content>

<asp:content runat="server" contentplaceholderid="content">
<asp:literal runat="server" text="<%$ Resources: HowWillUsersAccess %>"/>
<br/>
<br/>
<table width="62%">
    <tr>
        <td><asp:radioButton runat="server" id="fromInternet" groupName="auth" checked="true" /></td>
        <td class="bodyTextNoPadding">
            <asp:label runat="server" associatedcontrolid="fromInternet" font-bold="true" text="<%$ Resources:FromInternet %>"/>
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td class="bodyTextNoPadding">
        <asp:literal runat="server" text="<%$ Resources: InternetExplanation %>"/>        
        </td>
    </tr>
    <tr>
        <td><asp:radioButton runat="server" id="fromNetwork" type="radio" groupName="auth"/></td>
        <td class="bodyTextNoPadding">
            <asp:label runat="server" associatedcontrolid="fromNetwork" font-bold="true" text="<%$ Resources:FromNetwork %>"></asp:label>
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td class="bodyTextNoPadding">
        <asp:literal runat="server" text="<%$ Resources: NetworkExplanation %>"/>        
        </td>
    </tr>
</table>
</asp:content>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -