为我的网站使用表单身份验证,但出现错误
if (reader1.Read())
{
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
tbDomainID.Text,
DateTime.Now,
DateTime.Now.AddMinutes(30),
true,
role = reader1.GetInt64(0),// this line
FormsAuthentication.FormsCookiePath);
string hash = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(
FormsAuthentication.FormsCookieName,
hash);
if (ticket.IsPersistent) cookie.Expires = ticket.Expiration;
Response.Cookies.Add(cookie);
当我将它从转换GetString(0)
为GetInt64(0)
in 时会显示另一个错误
无法将类型“long”隐式转换为“string”
任何人都可以告诉我哪里出错或我该怎么做。
我正在从我的数据库中获取整数值。