Partager via


Download a File

 

Applies To: Windows Server 2012 Essentials

Retrieves the binary content of a file, in bytes.

URI Template

GET services/builtin/FileContentAccessService.svc/filecontent?path={path}

{path}
A network path that begins with the server name, in the format /ServerName/FolderPath/FileName.

Sample Request

GET https://www.contoso.com/services/builtin/FileContentAccessService.svc/filecontent?path=servername/Company/1.cs HTTP/1.1  
Accept: application/xml  
Cookie: ASP.NET_SessionId=********************  
Canary: *********************  
Host: domainname  
Range:  

Sample Response

HTTP/1.1 200 OK  
Cache-Control: private  
Content-Length: 28675  
Content-Type: application/octet-stream  
Accept-Ranges: bytes  
ETag: "FakeStrongETAG"  
Server: Microsoft-IIS/8.0  
Content-Disposition: attachment; filename="1.cs"  
X-AspNet-Version: 4.0.30319  
X-Powered-By: ASP.NET  
X-Content-Type-Options: nosniff  
Date: Mon, 31 Oct 2011 07:42:33 GMT  
  
<file content>  

Error Codes

Error Code Error Message
400 The path is too long or has unsupported characters (such as *\&#124;"<>).
401 Access is denied to the requested resource.
404 The path does not exist.

Remarks

The caller is supposed to read the response stream. The method supports the retrieval of partial content of the file, in which the range of the file is specified by the Range header field in the HTTP request.

See Also

Web Service Methods