WebRequest.UseDefaultCredentials WebRequest.UseDefaultCredentials WebRequest.UseDefaultCredentials WebRequest.UseDefaultCredentials Property

定义

当在子代类中重写时,获取或设置一个 Boolean 值,该值控制 DefaultCredentials 是否随请求一起发送。When overridden in a descendant class, gets or sets a Boolean value that controls whether DefaultCredentials are sent with requests.

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;否则为 falsetrue if the default credentials are used; otherwise false. 默认值为 falseThe default value is false.

异常

您尝试在该请求发送之后设置此属性。You attempted to set this property after the request was sent.

当未在子类中重写该属性时,尝试访问该属性。Any attempt is made to access the property, when the property is not overridden in a descendant class.

注解

如果此true WebRequest对象发出的请求应在服务器请求时使用当前登录用户的凭据进行身份验证,请将此属性设置为。Set this property to true when requests made by this WebRequest object should, if requested by the server, be authenticated using the credentials of the currently logged on user. 对于客户端应用程序,这在大多数情况下都是所需的行为。For client applications, this is the desired behavior in most scenarios. 对于中间层应用程序(如 ASP.NET 应用程序),通常应将Credentials属性设置为代表其发出请求的客户端的凭据。For middle tier applications, such as ASP.NET applications, instead of using this property, you would typically set the Credentials property to the credentials of the client on whose behalf the request is made.

适用于