0
如何根據用戶是否登錄獲取默認值?獲取數據以在c#中設置默認值?
public class ShippingDetails {
public ShippingDetails() {
if (HttpContext.Current.User.Identity.Name != "") {
Name = "";
}
}
public string Name { get; set; }
}
涼爽。似乎也是這樣。不知道在我的方法中使用你的方法是否有好處,反之亦然 –
@Shredder,不確定,但我更喜歡使用Request.IsAuthenticated,因爲它明確了我正在檢查的內容。 – Brandon
我會說他們都很清楚.. –