InternetPassword 属性

指定连接到 SQL Server Compact 3.5 服务器代理时使用的密码。

命名空间:  System.Data.SqlServerCe
程序集:  System.Data.SqlServerCe(在 System.Data.SqlServerCe.dll 中)

语法

声明
Public Property InternetPassword As String
    Get
    Set
用法
Dim instance As SqlCeReplication
Dim value As String

value = instance.InternetPassword

instance.InternetPassword = value
public string InternetPassword { get; set; }
public:
property String^ InternetPassword {
    String^ get ();
    void set (String^ value);
}
member InternetPassword : string with get, set
function get InternetPassword () : String
function set InternetPassword (value : String)

属性值

类型:System. . :: . .String
Internet 信息服务 (IIS) 密码字符串。默认为没有密码。

注释

如果 SQL Server Compact 3.5 服务器代理配置为使用基本身份验证或集成 Windows 身份验证,则需要 InternetPassword 属性。在使用集成 Windows 身份验证时,不通过网络传递 InternetPassword。

使用基本身份验证时,应将 IIS 配置为使用安全套接字层 (SSL) 或专用通信技术 (PCT) 加密,这有助于保护用户密码的安全。如果没有 SSL 或者 PCT 加密,基本身份验证将以容易解密的形式在网络上传递密码。这是不安全的。因此,在使用基本身份验证时,请始终使用 SSL 或 PCT 加密以帮助保护密码的安全。

示例

下面的示例设置 SqlCeReplication 对象的 InternetPassword 属性。

Dim repl As SqlCeReplication = Nothing

Try
    ' Instantiate and configure SqlCeReplication object
    '
    'NOTE: when possible, prompt users to enter security 
    'credentials at runtime. If you store credentials in a file, 
    'you must secure the file to prevent unauthorized access.
    '
    repl = New SqlCeReplication()
    repl.InternetUrl = "https://www.adventure-works.com/sqlce/sqlcesa35.dll"
    repl.InternetLogin = "MyInternetLogin"
    repl.InternetPassword = "<enterStrongPassword>"
    repl.Publisher = "MyPublisher"
    repl.PublisherDatabase = "MyPublisherDatabase"
    repl.PublisherLogin = "MyPublisherLogin"
    repl.PublisherPassword = "<enterStrongPassword>"
    repl.Publication = "MyPublication"
    repl.Subscriber = "MySubscriber"
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf"

    ' Create the local SQL Mobile Database subscription
    '
    repl.AddSubscription(AddOption.CreateDatabase)

    ' Synchronize to the SQL Server to populate the Subscription 
    '
    repl.Synchronize()
Catch
    ' Handle errors here
    '
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Instantiate and configure SqlCeReplication object
    //
    //NOTE: when possible, prompt users to enter security 
    //credentials at runtime. If you store credentials in a file, 
    //you must secure the file to prevent unauthorized access.
    //
    repl = new SqlCeReplication();
    repl.InternetUrl = "https://www.adventure-works.com/sqlce/sqlcesa35.dll";
    repl.InternetLogin = "MyInternetLogin";
    repl.InternetPassword = "<enterStrongPassword>";
    repl.Publisher = "MyPublisher";
    repl.PublisherDatabase = "MyPublisherDatabase";
    repl.PublisherLogin = "MyPublisherLogin";
    repl.PublisherPassword = "<enterStrongPassword>";
    repl.Publication = "MyPublication";
    repl.Subscriber = "MySubscriber";
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Create a local SQL Mobile Database subscription
    //
    repl.AddSubscription(AddOption.CreateDatabase);

    // Synchronize to the SQL Server database
    //
    repl.Synchronize();
}
catch (SqlCeException)
{
    // Handle errors here
    //
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

请参阅

参考

SqlCeReplication类

SqlCeReplication 成员

System.Data.SqlServerCe 命名空间