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)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple := False)> _
Public NotInheritable Class CredentialAttribute _
    Inherits Attribute
'Usage
Dim instance As CredentialAttribute
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false)]
public sealed class CredentialAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Method, AllowMultiple = false)]
public ref class CredentialAttribute sealed : public Attribute
public final class CredentialAttribute extends Attribute

Remarks

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.

Warning

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.

Inheritance Hierarchy

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

Thread Safety

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

See Also

Reference

CredentialAttribute Members

Microsoft.VisualStudio.TestTools.UnitTesting.Web Namespace

Other Resources

ASP.NET Unit Tests

How to: Create an ASP.NET Unit Test