PrepAway - Latest Free Exam Questions & Answers

Author: seenagape

Which code segment should you use?

You are customizing a Windows Form to update a database asynchronously by using an instance of a BackgroundWorker component named bgwExecute. You start the component by using the following code.

Private Sub StartBackgroundProcess()
AddHandler bgwExecute.DoWork, _
New DoWorkEventHandler(AddressOf WorkHandler)
AddHandler bgwExecute.RunWorkerCompleted, _
New RunWorkerCompletedEventHandler(AddressOf _
CompletedHandler)
AddHandler bgwExecute.ProgressChanged, _
New ProgressChangedEventHandler(AddressOf ProgressChanged) bgwExecute.RunWorkerAsync()
End Sub

If the UpdateDB method that is called by the BackgroundWorker component returns the value False, you need to display a message box to the user that indicates that the update failed. Which code segment should you use?

What should you do?

When you execute a client application, the following exception is
thrown.

EncryptedKeyToken is expected but not present in the security header of the incoming message.

You discover that the exception is thrown when the client application invokes a Web service named Math with the following code.

(Line numbers are included for reference only.)
01 try
02 {
03 MathWse ws = new MathWse ();
04 int result = ws.Add(1, 2);
05 }
06 catch (Exception ex)
07 {
08 MessageBox.Show(ex.Message);
09 }

The client application and Web service have the same Web Services Enhancements (WSE) 3.0 policy.
The policy configuration file contains the following policy section.

<policy name=”Secure”>
<anonymousForCertificateSecurity establishSecurityContext=”false” renewExpiredSecurityContext=”true” requireSignatureConfirmation=”false” messageProtectionOrder=”SignBeforeEncrypt” requireDerivedKeys=”true” ttlInSeconds=”300″>
<!– XML defining the serviceToken and protection –>
</anonymousForCertificateSecurity>
</policy>

You need to ensure that the client application can communicate with the Web service.

What should you do?