Condividi tramite


Adding support for networking (XAML)

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

Purpose

This topic shows how to set network capabilities required for network access, handle network connections as background tasks, secure and troubleshoot network connections, and handle network exceptions for a Windows Runtime app.

Windows 8.1 provides support for making your Windows Runtime app connected or network-aware. In order to provide a reliable connected experience for users, you will need to define the resource requirements before network access is provided. Networked apps should also accommodate the Windows 8.1 device lifecycle, including frequent transitions between different networks and power states, and apps being suspended and no longer in the foreground. It is also helpful to know how to start troubleshooting if your app encounters network-related errors.

The following scenarios for Windows Store apps are supported:

  • Set network capabilities required for network access.
  • Handle long-lived network connections with background tasks.
  • Secure network connections established by your app.
  • Use data caching with network operations.
  • Handle network exceptions in your app.
  • Troubleshoot and debug network connections established by your app.

This section contains information on adding support for networking to your app.

Topic Descriptions
How to set network capabilities Explains how to control the security profile of a Windows Runtime app and set levels of access to your networked app by selecting the appropriate capabilities.
How to secure connections and authenticate requests Explains how to secure connections and provide authentication credentials required to establish and use secure network connections.
How to use data caching during network operations Explains how to use data caching with network operations in a Windows Runtime app.
Stay connected in the background Explains the background network connectivity feature in Windows 8.1 and how to configure background connectivity options for a Windows Store app.
Handling exceptions in network apps Explains how to handle exceptions when using networking APIs in a Windows Runtime app.
Troubleshooting and debugging network connections Provides a number of methods for troubleshooting errors and issues related to network connections.

 

Developer audience

Developers interested in creating connected and network-aware Windows Runtime apps using VB/C#/C++ and XAML.

Other resources

Connecting to a web service

Connecting with sockets

Connecting with WebSockets

Working with Live services

Proximity and tapping

Accessing connection and data plan information

Accessing syndicated web content

Reference

Windows.Networking

Windows.Networking.BackgroundTransfer

Windows.Networking.NetworkOperators

Windows.Networking.Connectivity

Windows.Networking.Proximity

Windows.Networking.PushNotifications

Windows.Networking.Sockets

Windows.Web.AtomPub

Windows.Web.Http

Windows.Web.Syndication

Samples

AtomPub sample

Background Transfer sample

DatagramSocket sample

HttpClient Sample

Network Information sample

Syndication sample

StreamSocket sample

Web authentication sample

WebSockets sample