<script language="vb" runat="server">    sub page_load(sender as object, e as eventargs) {        if user.identity.isauthenticated then            welcome.text = "欢迎" + user.identity.name        else            ' 尚未登录,添加一个指向登录页的链接            welcome.text = "请登录!"            welcome.navigateurl = "signin.aspx"        end if    end sub</script><asp:hyperlink id="welcome" runat="server" maintainstate="false"></asp:hyperlink><script language="c#" runat="server">    void page_load(object sender, eventargs e) {        if (user.identity.isauthenticated) {            welcome.text = "欢迎" + user.identity.name;        }        else {            // 尚未登录,添加一个指向登录页的链接            welcome.text = "请登录!";            welcome.navigateurl = "signin.aspx";        }    }</script><asp:hyperlink id="welcome" runat="server" maintainstate="false"></asp:hyperlink>
      sub application_beginrequest(sender as [object], e as eventargs)                  dim tabindex as integer = 0         dim tabid as integer = 0                  ' 从查询字符串获取 tabindex         if not (request.params("tabindex") is nothing) then            tabindex = int32.parse(request.params("tabindex"))         end if                  ' 从查询字符串获取 tabid         if not (request.params("tabid") is nothing) then            tabid = int32.parse(request.params("tabid"))         end if                  context.items.add("portalsettings", _new portalsettings(tabindex, tabid))      end subvoid application_beginrequest(object sender, eventargs e) {            int tabindex = 0;    int tabid = 0;    // 从查询字符串获取 tabindex    if (request.params["tabindex"] != null) {                       tabindex = int32.parse(request.params["tabindex"]);    }                    // 从查询字符串获取 tabid    if (request.params["tabid"] != null) {                      tabid = int32.parse(request.params["tabid"]);    }    context.items.add("portalsettings", new portalsettings(tabindex, tabid));}<%@ import namespace="aspnetportal" %><%@ import namespace="system.data.sqlclient" %><script language="c#" runat="server">    public int          tabindex;    public bool         showtabs = true;    protected string    logofflink = "";    void page_load(object sender, eventargs e) {        // 从当前上下文获取 portalsettings  portalsettings portalsettings = (portalsettings) context.items["portalsettings"];        // 动态填充门户站点名称        sitename.text = portalsettings.portalname;        // 如果用户已登录,自定义欢迎信息        if (request.isauthenticated == true) {                    welcomemessage.text = "欢迎" + context.user.identity.name + "!<" + "span class=accent" + ">|<" + "/span" + ">";            // 如果身份验证模式为 cookie,则提供一个注销链接            if (context.user.identity.authenticationtype == "forms") {                logofflink = "<" + "span class=/"accent/">|</span>/n" + "<a href=" + request.applicationpath + "/admin/logoff.aspx class=sitelink> 注销" + "</a>";            }        }        // 动态显示门户选项卡条        if (showtabs == true) {            tabindex = portalsettings.activetab.tabindex;            // 生成要向用户显示的选项卡列表                                               arraylist authorizedtabs = new arraylist();            int addedtabs = 0;            for (int i=0; i < portalsettings.desktoptabs.count; i++) {                            tabstripdetails tab = (tabstripdetails)portalsettings.desktoptabs[i];                if (portalsecurity.isinroles(tab.authorizedroles)) {                     authorizedtabs.add(tab);                }                if (addedtabs == tabindex) {                    tabs.selectedindex = addedtabs;                }                addedtabs++;            }                      // 用已授权的选项卡填充页顶部的选项卡// 列表            tabs.datasource = authorizedtabs;            tabs.databind();        }    }</script><table width="100%" cellspacing="0" class="headbg" border="0">    <tr valign="top">        <td colspan="3" align="right">            <asp:label id="welcomemessage" runat="server" />            <a href="<%= request.applicationpath %>">portal 主页</a><span class="accent"> |</span> <a href="<%= request.applicationpath %>/docs/docs.htm">                portal 文档</a>            <%= logofflink %>                      </td>    </tr>    <tr>        <td width="10" rowspan="2">                     </td>        <td height="40">            <asp:label id="sitename" runat="server" />        </td>        <td align="center" rowspan="2">               </td>    </tr>    <tr>        <td>            <asp:datalist id="tabs" runat="server">               <itemtemplate>                   <a href='<%= request.applicationpath %>/desktopdefault.aspx?tabindex=<%# container.itemindex %>&tabid=<%# ((tabstripdetails) container.dataitem).tabid %>'><%# ((tabstripdetails) container.dataitem).tabname %></a>                 </itemtemplate>                <selecteditemtemplate>                                     <span class="selectedtab"><%# ((tabstripdetails) container.dataitem).tabname %></span>                 </selecteditemtemplate>            </asp:datalist>        </td>    </tr></table>新闻热点
疑难解答