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
「網際網路資訊服務」(IIS) 密碼字串。預設為沒有密碼。
備註
如果「SQL Server Compact 3.5 伺服器代理程式」是設定為使用「基本驗證」或「整合式 Windows 驗證」,則需要 InternetPassword 屬性。使用「整合式 Windows 驗證」時,InternetPassword 不會透過網路傳遞。
使用「基本驗證」時,您應該將 IIS 設定成使用安全通訊端層 (SSL) 或 Private Communication Technology (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();
}