Share via


WebControlsSection.ClientScriptsLocation 属性

定义

获取客户端脚本位置。

public:
 property System::String ^ ClientScriptsLocation { System::String ^ get(); };
[System.Configuration.ConfigurationProperty("clientScriptsLocation", DefaultValue="/aspnet_client/{0}/{1}/", IsRequired=true)]
[System.Configuration.StringValidator(MinLength=1)]
public string ClientScriptsLocation { get; }
[<System.Configuration.ConfigurationProperty("clientScriptsLocation", DefaultValue="/aspnet_client/{0}/{1}/", IsRequired=true)>]
[<System.Configuration.StringValidator(MinLength=1)>]
member this.ClientScriptsLocation : string
Public ReadOnly Property ClientScriptsLocation As String

属性值

客户端脚本的位置。

属性

示例

下面的代码示例演示如何获取 ClientScriptsLocation


// Get the Web application configuration.
System.Configuration.Configuration configuration =
    WebConfigurationManager.OpenWebConfiguration(
    "/aspnetTest");

// Get the <webControls> section.
WebControlsSection webControlsSection =
  (WebControlsSection)configuration.GetSection(
  "system.web/webControls");

// Read the client script location.
string clientScriptLocation =
    webControlsSection.ClientScriptsLocation;

string msg = String.Format(
"Client script location: {0}\n",
clientScriptLocation);

Console.Write(msg);

' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")

' Get the <webControls> section.
Dim webControlsSection _
As WebControlsSection = _
CType(configuration.GetSection( _
"system.web/webControls"), WebControlsSection)

' Read the client script location.
Dim clientScriptLocation As String = _
webControlsSection.ClientScriptsLocation

Dim msg As String = _
String.Format( _
"Client script location: {0}" + _
ControlChars.Lf, clientScriptLocation)
Console.Write(msg)

注解

有关客户端脚本及其用法的详细信息,请参阅 ASP.NET 网页 中的客户端脚本

适用于

另请参阅