Massive Selection of Microsoft eBooks

There are millions of ebooks available for download on the internet and not all of them are available legally. However, Eric Ligman (Microsoft Senior Sales Excellence Manager) has compiled a massive list of freely, and legally, available Microsoft ebooks on his blog. They cover a large range of topics including, but not limited to

  • Windows 7
  • Windows 8
  • Windows 8.1
  • Office 2010
  • Office 2013
  • Office 365
  • SharePoint 2013
  • Dynamics CRM
  • PowerShell
  • Exchange Server
  • Lync 2013
  • System Center
  • Azure
  • Cloud
  • SQL Server
  • ASP.NET
  • C#

They are all available by permission of the copyright license/owner which may change in the future. Fot this reason I am not linking directly to any but to view the full list go here: largest-collection-of-free-microsoft-ebooks-ever

Click here for other posts relating to free books.

Display pdf in a web page

If Adobe Reader (or equivalent) is not installed the user may see a save/open dialog. To display a pdf document in a browser and prevent the dialog from being shown use the following example code.

var fullURL = "http://www.somedomain.com?id=<some_id>"
var client= new System.Net.WebClient();
Byte[] buffer = client.DownloadData(fullURL);

if (buffer != null)
{
    Response.ClearHeaders();
    Response.ContentType = "application/pdf";
    Response.Clear();
    Response.AddHeader("content-length", buffer.Length.ToString());
    Response.BinaryWrite(buffer);
    Response.End();
}

This is particularly useful when displaying pdf data read from the database.

reader = objDBCommand.ExecuteReader();
if (reader.HasRows)
{
    while (reader.Read())
    {
        int columnIndex = reader.GetOrdinal(*ColumnNameHere*);
        returnData = (byte[])reader.GetValue(columnIndex);
    }
}

returnData now contains the byte array of PDF data to be written out.

[UPDATE 1st July 2015]
In the above example the pdf data is retrieved from a URL. If the file already exists or downloaded file is saved locally then the Response methods change slightly. You can use AppendHeader() instead of AddHeader() and TransmitFile() instead of BinaryWrite().

string filePath = *FilePathHere*;
string fileName = Path.GetFileName(filePath);
...
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;Filename=" + fileName);
HttpContext.Current.Response.TransmitFile(filePath);
...