This documentation is archived and is not being maintained.

CredentialAttribute Class

Specifies the user name and password for ASP.NET sites that require basic authentication or Windows authentication. This class cannot be inherited.

Namespace:  Microsoft.VisualStudio.TestTools.UnitTesting.Web
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false)]
public sealed class CredentialAttribute : Attribute

If a site uses Windows Authentication, the supplied credentials will override the logged in user's credentials.

This attribute targets methods. Only one instance of this attribute may be applied to a method.

Caution noteCaution:

The password is stored in plain text in source code and in the compiled assembly. Restrict access to the source code and assembly to help protect this sensitive information.

For more information about how to use attributes, see Extending Metadata Using Attributes.

System.Object
  System.Attribute
    Microsoft.VisualStudio.TestTools.UnitTesting.Web.CredentialAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: