eBooks from Andy Wigley
All books and eBooks by Andy Wigley:
Microsoft® .NET Compact ...
by Andy Wigley, Stephen Whee..., Rory MacLoed, Mark Sutton, and Robert Burbr...
420 Part III Common Programming Tasks The .NET Compact Framework has a security architecture that is similar to that of the desktop .NET Framework. However, the System.Security namespace in version 1 of the .NET Compact Framework contains only the SecurityPermis- sionAttribute class (and its parent classes), which is for use with code access security, and there are no classes for role-based security. The lack of additional security features in the .NET Compact Framework is due to the fact that Win- dows CE does not have the same concept of a specific logon user that a desk- top Windows machine does. In version 1 of the .NET Compact Framework, there is actually nothing developers can do to manage application security. A future version will imple- ment more fine-grained support for security programming, but in this version the fixed security policy dictates that all code run effectively with a full set of
(2009)
Microsoft® Mobile Develo...
by Andy Wigley, Daniel Moth, and Peter Foot
C08623583.fm Page 312 Monday, December 10, 2007 9:45 PM 312 Part II Solutions for Challenges in Mobile Application To help you put all these concepts together, the following code sample shows a method to perform a download and save the received data to the device file system. private void Download(Uri address, string localPath) { string filename = address.Segments[u.Segments.Length - 1]; WebRequest request = WebRequest.Create(u); //Perform the GET request. WebResponse response = request.GetResponse(); //Get stream containing received data. Stream s = response.GetResponseStream(); //Open filestream for the output file. FileStream fs = new FileStream(Path.Combine(localPath, filename), FileMode.Create, FileAccess.Write); //Copy until all data is read. byte[] buffer = new byte[1024]; int bytesRead = s.Read(buffer, 0, buffer.Length); while (bytesRead > 0) { fs.Write(buffer, 0, bytesRead); bytesRead = s.Read(buffer, 0, buffer.Length); } //Close both streams. fs.Close(); s.Close(); response.Close(); } You can use the WebRequest approach to download or upload content for your application, or even to
(2010)

