Get link from HTML code anchor tag

Task: Get Link from HTML code anchor <a> tag using and C# code.

Description:  Sometime we need to retrieve link from HTML code <a> tag Or sometime we need to modify/append/alter that link.
So in this function the HTML code is use as input and then we can retrieve link in that html code <a> tag.


public void getlinkfromhtml(string content)
  int index = 0;
    int newindex = index + 5;
    index = content.IndexOf("href=", newindex);
    if (index > 0)
      int index2 = content.IndexOf('\'', index + 6);
      int index3 = content.IndexOf('\"', index + 6);

      if (index3 > 0)
        if (index2 > index3 || index2 == (-1))
            index2 = index3;
      if (index2 > 0)
        string href = content.Substring(index+6,(index2-(index + 6))).ToLower();

// Save/Use or do anything with this link href. You Can replace also this with another link.

  while (index > 1);

View Pdf on browser using

Task: View Pdf on browser using

Description: Here I show how we can view the pdf file on browser using and c#.

using System.Net;
public void viewebook(string pdf_filepath)
    string FilePath = Server.MapPath(pdf_filepath);
    WebClient User = new WebClient();
    Byte[] FileBuffer = User.DownloadData(FilePath);
    if (FileBuffer != null)
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-length", FileBuffer.Length.ToString());


Facebook feed using graph api

Task: Get Facebook page feed using graph api.

Description: As facebook depreciated old feed url ( So now we need to use its graph api for this.

Here I describe how to get facebook page feed using graph api using javascript code. You just need to update your access token ( use app token as access token from here ). 

you can run below url on your browser for all fields and can use as your requirements. In below code limit is use for how many post will return.|gtYtk8w5_qPHbZkSpJ9pwD7Qy-8

<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
 FB.api('', { limit: 20 }, function (response) {

 if (response && !response.error) {
 var msg='';
            for (var i = 0, l =; i < l; i++) {
                var post =[i];
                var userid =;
                if (post.message) {                       
                    msg += '<span style="word-break: break-all;">'+ post.message  + '<br/><a  rel="nofollow" href=''><img src=' +  post.picture  +' /></a>' + '</span><br/><br/>';                       
               // alert('Error Occure');

<div id="fb-root"></div>
<div id="sFbFeeds"></div>