有一个BBS模板了,由于是企业使用,为了安全期间想在前面加一个登陆界面(ASPX),不知是否可以,不知如何实现.谢谢大家.,请有没有提供的朋友.

解决方案 »

  1.   

    登录判断session等
    也可使用forms验证
      

  2.   

    Response.Redirect("")
    location.href
      

  3.   

    如果高手方便,代码发我邮件[email protected],初学者。“登陆界面”---“一个BBS版面”
      

  4.   

    #4楼 怎么做,BBS没有这个功能,是不是要从代码中改。是否要提供代码?
      

  5.   

            if (!IsPostBack)
            {
                if (Session["admin"] == null)
                {
                    Response.Write("<script>location='Login.aspx';</script>");
                }
                else
                {
                    if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    {
                        DetailsView1.DefaultMode = DetailsViewMode.Insert;
                    }
                }
            }
      

  6.   

    我刚做过,给你一段代码吧
    登录界面后台CS
         protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = new HttpCookie("myName", "");
            Response.Cookies.Add(cookie);
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string id = Request.Form["username"].ToString().Trim();
            string pwd = Request.Form["password"].ToString().Trim();
            if (BLL_Admin.Exits(id, pwd))
            {
                if (!BLL.BLL_Expert.exitOld(id))
                {
                    Response.Cookies["myName"].Value = id;
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    webMesgShow("您已经提交数据,不能在登陆!");
                }
            }
            else
            {
                webMesgShow("用户名或密码错误!");
            }
        }
      

  7.   

    这段代码可以直接用的,主要的页面要放一个判断的
             string myName= Request.Cookies["myName"].Value.Trim();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            if (string.IsNullOrEmpty(myName))
            {
                Response.Redirect("~/Login.aspx");
            }
      

  8.   

    ——————————LOGIN.cs——————————————————
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = new HttpCookie("myName", "");
            Response.Cookies.Add(cookie);
        }
        
        protected void Button1_Click(object sender, EventArgs e)
        {
            string id = Request.Form["username"].ToString().Trim();
            string pwd = Request.Form["password"].ToString().Trim();
            if (BLL_Admin.Exits(id, pwd))
            {
                if (!BLL.BLL_Expert.exitOld(id))
                {
                    Response.Cookies["myName"].Value = id;
                    Response.Redirect("index.aspx");
                }
                else
                {
                    webMesgShow("您已经提交数据,不能在登陆!");
                }
            }
            else
            {
                webMesgShow("用户名或密码错误!");
            }
        }}
    string myName= Request.Cookies["myName"].Value.Trim();
      Response.Cache.SetCacheability(HttpCacheability.NoCache);
      if (string.IsNullOrEmpty(myName))
      {
      Response.Redirect("~/Login.aspx");
      }
    ——————————————————————————
    -------------------login.aspx---------------------------
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="username" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
            <asp:TextBox ID="password" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
        </form>
    </body>
    </html>
    ------------------------------------------------------各位,再麻烦,帮我看看。