2013-12-23 60 views
0

我如何閱讀User.Identity.Name值,我的gridview沒有顯示任何東西。需要幫忙。如何閱讀User.Identity.Name?

//lblName.Text = HttpContext.Current.User.Identity.Name; 
//string email = lblName.Text; 
var result = from r in db.Orders 
      where r.Email == Page.User.Identity.Name 
      //join p in db.OrderLists on r.Order_ID equals p.Order_ID 
      //join s in db.MenuItems on p.Item_ID equals s.Item_ID 
      select r.DateTime; 

GridView1.DataSource = result; 
GridView1.DataBind(); 
+0

窗口還是網頁? asp.net? – zey

+0

你得到的Page.User.Identity.Name的值是多少?如果它爲null,則將其添加到web配置

回答

1

嘗試使用HttpContext.Current.User.Identity.Name