AspNetDevelopmentServerPrefix Field
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

TestContext.AspNetDevelopmentServerPrefix Field

Represents the prefix for ASP.NET Development Server.

Namespace: Microsoft.VisualStudio.TestTools.UnitTesting
Assembly: Microsoft.VisualStudio.QualityTools.UnitTestFramework (in microsoft.visualstudio.qualitytools.unittestframework.dll)

public const string AspNetDevelopmentServerPrefix
public static final String AspNetDevelopmentServerPrefix
public const var AspNetDevelopmentServerPrefix : String

The value of this constant is "AspNetDevelopmentServer."

In most cases, you will not use this string directly because you can use the TryUrlRedirection method to direct web service calls to the correct URL.

If you want to get the URL prefix for the ASP.NET Development Server instance that is launched as a result of specifying the AspNetDevelopmentServerAttribute on your test, then you need to use this string. Use this string along with the name specified in the AspNetDevelopmentServerAttribute. See the following code snippet for more information.

[TestMethod]
[AspNetDevelopmentServerAttribute("MyServer", @"c:\websites\website1", "/website1")]
public void Test()
{
    Uri uriPrefix = TestContext.Properties[TestContext.AspNetDevelopmentServerPrefix + "MyServer"];
}
Show:
© 2016 Microsoft