求助 ! vs2005 Login 控件使用的问题~!

using  System;
using  System.Data;
using  System.Configuration;
using  System.Collections;
using  System.Web;
using  System.Data.SqlClient;
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  _Default : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{
    }


    
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
    
{
        
bool boolReturnValue = false;
        
// Insert code that implements a site-specific custom 
        
// authentication method here.
        
// This example implementation always returns false.
        string strConnection = "server=.;database=liuwei;uid=sa;pwd=;";
        SqlConnection Connection 
= new SqlConnection(strConnection);
        String strSQL 
= "Select * From liuwei";
        SqlCommand command 
= new SqlCommand(strSQL, Connection);
        SqlDataReader Dr;
        Connection.Open();
        Dr 
= command.ExecuteReader();
        
while (Dr.Read())
        
{
            
if ((UserName == Dr["name"].ToString()) & (Password == Dr["Password"].ToString()))
            
{
                boolReturnValue 
= true;
            }

            Dr.Close();
            
return boolReturnValue;
        }

    }

   
    
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    
{
        
bool Authenticated = false;
        Authenticated 
= SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
        e.Authenticated 
= Authenticated;
        
if (Authenticated == true)
        
{
            Response.Redirect(
"Default2.aspx");
        }

   }

    
}

 


当我运行的时候 就报出错误 “_Default.SiteLevelCustomAuthenticationMethod(string, string)”: 并非所有的代码路径都返回值   请教一下是怎么搞的~!
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值