WebRequest.UseDefaultCredentials 属性

定义

当在子代类中重写时,获取或设置一个 Boolean 值,该值控制 DefaultCredentials 是否随请求一起发送。

public:
 virtual property bool UseDefaultCredentials { bool get(); void set(bool value); };
public virtual bool UseDefaultCredentials { get; set; }
member this.UseDefaultCredentials : bool with get, set
Public Overridable Property UseDefaultCredentials As Boolean

属性值

如果使用默认凭据,则为 true;否则为 false。 默认值是 false

例外

你试图在发送请求后设置该属性。

当未在子类中重写该属性时,尝试访问该属性。

注解

如果此对象发出的WebRequest请求应使用当前登录用户的凭据进行身份验证,则将此属性true设置为 。 对于客户端应用程序,这是在大多数情况下所需的行为。 对于中间层应用程序(例如 ASP.NET 应用程序),通常将 属性设置为 Credentials 代表其发出请求的客户端的凭据,而不是使用此属性。

适用于