怎样打开需要输入用户名和密码后才能打开的网页?

解决方案 »

  1.   

    ............
    如果 UserName=="UserName" And pwd="pwd"
     那么 打开网页
    否则  不打开网页
      

  2.   

    先去数据库判断用户名密码是否正确
    bool isLogin = 判断用户名和密码,正确返回true,错误返回false
    if(isLogin)
    {
        Response.Redirect("显示信息的页");
    }
    else
    {
        Response.Write("<script>alert('用户名或密码错误!')</script>");
    }
      

  3.   

    不好意思,我的问题描述得不清楚,应该是网页如何自动登陆和提交,我在这个帖子里找到了答案http://blog.csdn.net/octverve/archive/2008/02/24/2117371.aspx,但是遇到了一个新的问题,如何提交网页上的javascript代码?
      

  4.   

    如何提交网页上的javascript代码????你说的是什么意思?
      

  5.   

    --!!不好意思again,又描述不清楚,就是比如网页上有这么一个函数
    function confirmuser()
    {
      document.Outline.action="/cgi-bin/confirmuser";
      document.Outline.v_newuser.value = "0";
      if(document.Outline.v_regname.value == "" && document.Outline.v_cardno.value == "")
      {
          alert("请输入注册名或证号!");
          return;
      }
      if(document.Outline.v_passwd.value == "")
      {
          alert("请输入登录密码!");
          return;
      }
      document.Outline.submit();
    }
    在C#中可以调用它吗?
      

  6.   

    可以调用啊,在pageload里写上下面这句
    button1.Attribute["onclick"] = "confirmuser()";或者在html页写上下面的
    <asp:Button runat="server" id="btnsubmit" text="提交" OnClientClick="confirmuser()">都可以
      

  7.   

    如果你说的是想在C#中调用function函数的话,就在“设计/源”中的"源"中去调用,方法如6楼说的
      

  8.   


    Page.ClientScript.RegisterStartupScript(GetType(), "key", "<script>confirmuser()</script>");
    这样即可调用JS方法