Tải bản đầy đủ (.pdf) (9 trang)

Silverlight tiếng việt phần 8 pps

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.2 MB, 9 trang )

bên trong
a.
WebClient
t domain
WebClient HttpWebRequest/HttpWebResponse
.
e.
ain policy


tin cross-domain policy;
Silverlight Cross-Domain Policy (clientaccesspolicy.xml)
ain.
Request URI Cross-Domain Policy File Location


:8080/services/data :8080/clientaccesspolicy.com
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy >
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/services/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
sau:


+ domain
+ secure true false
+ headers
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
" /><cross-domain-policy>
<allow-access-from domain="*"/ headers="SOAPAction"
secure="true">
</cross-domain-policy>
Add S
ervice Reference
System
.Net
+ WebClient
+ HttpWebRequest và HttpWebResponse
WebClient
WebClient.
GET
n
POST
WebClient
+ WebClient ::.OpenWriteAsync
+ WebClient ::.UploadStringAsync
WebClient ::.Headers

WebClient client = new WebClient();
public Page()
{
InitializeComponent();


client.UploadStringCompleted +=
new UploadStringCompletedEventHandler(client_UploadStringCompleted);
}
private void Button_Click(object sender, RoutedEventArgs e)
{

string postRequest = "<entry xmlns=' /> + "<title type='text'>New Restaurant</title>"
+ "<content type='xhtml'>"
+ " <div xmlns=' /> + " <p>There is a new Thai restaurant in town!</p>"
+ " <p>I ate there last night and it was <b>fabulous</b>.</p>"
+ " <p>Make sure and check it out!</p>"
+ " </div>"
+ " </content>"
+ " <author>"
+ " <name>Pilar Ackerman</name>"
+ " <email></email>"
+ " </author>"
+ "</entry>";

client.UploadStringAsync(new Uri(" /> UriKind.Absolute), postRequest);
}

void client_UploadStringCompleted(object sender,
UploadStringCompletedEventArgs e)
{

if (e.Error != null)
tb1.Text = e.Error.Message;
else
tb1.Text = e.Result;

}

WebClient System.Net
System.Net.Sockets
.
ó.
Reverse tunnel attack – Use a remote client’s outgoing connection as a back tunnel to the client’s private netwo
rk.

amespace System.Net.

.
không thành công.
to JSON, và Syndication components.





à public cho toàn domain
a.
b.
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>

<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
a.
b.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM " /><cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
ssdomain.xml
+

L
Cryptographic Services

×