social media count

http://fgte.st/SocialCount/examples/

API Calls (GET, PUT, POST,DELETE)

  #region API Calls

        #region GET

        public static HttpResponseMessage CallGETAPI(String uri, IEnumerable<dynamic> Params)
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                    if (HttpContext.Current.Session["Token"] != null && HttpContext.Current.Session["Token"] != "")
                        client.DefaultRequestHeaders.Add("X-My-Secret-Token", HttpContext.Current.Session["Token"].ToString());
                    return client.GetAsync(BaseAddress + "api/" + uri).Result;
                }
            }
            catch (Exception ex)
            {
                LogException("Call GET API ", ex.ToString());
                return new HttpResponseMessage() { StatusCode = System.Net.HttpStatusCode.InternalServerError };
            }

        }

        #endregion GET


        #region POST
        public static HttpResponseMessage CallPOSTAPI(String uri, Object Params)
        {
            using (HttpClient client = new HttpClient())
            {
             
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                if (HttpContext.Current.Session["Token"] != null && HttpContext.Current.Session["Token"].ToString() != "")
                    client.DefaultRequestHeaders.Add("X-My-Secret-Token", HttpContext.Current.Session["Token"].ToString());
                return client.PostAsJsonAsync(BaseAddress + "api/" + uri ,Params).Result;
            }
        }
        #endregion

        #region  PUT

        public static  HttpResponseMessage CallPUTAPI(String uri, Object Params)
        {
            using (HttpClient client = new HttpClient())
            {

                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                if (HttpContext.Current.Session["Token"] != null && HttpContext.Current.Session["Token"].ToString() != "")
                    client.DefaultRequestHeaders.Add("X-My-Secret-Token", HttpContext.Current.Session["Token"].ToString());
                return    client.PutAsJsonAsync(BaseAddress + "api/" + uri, Params).Result;
            }
        }

        #endregion PUT

        #region  DELETE

        public static  HttpResponseMessage CallDeleteAPI(String uri)
        {
            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                if (HttpContext.Current.Session["Token"] != null && HttpContext.Current.Session["Token"].ToString() != "")
                    client.DefaultRequestHeaders.Add("X-My-Secret-Token", HttpContext.Current.Session["Token"].ToString());
                return client.DeleteAsync(BaseAddress + "api/" + uri).Result;
            }
        }

        #endregion DELETE
        #endregion

Asp.net Gridview MakeAccessible and OnPreRender and RowDataBound

      public static void MakeAccessible(GridView grid)
        {
            if (grid.Rows.Count <= 0) return;
            grid.UseAccessibleHeader = true;
            grid.HeaderRow.TableSection = TableRowSection.TableHeader;
            if (grid.ShowFooter)
                grid.FooterRow.TableSection = TableRowSection.TableFooter;
        }

   

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            MakeAccessible(recentgrid);
        }


  protected void recentgrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Attributes.Add("data-class", "expand");
                e.Row.Cells[3].Attributes.Add("data-hide", "phone,tablet");
                e.Row.Cells[4].Attributes.Add("data-hide", "phone,tablet");
                e.Row.Cells[2].Attributes.Add("data-hide", "phone");
            }
        }

To trace all activities in project

<webconfig>
<System.web>

<trace pageOutput="true"
enabled="true"
requestLimit="10"
localOnly="false"
mostRecent="true"
traceMode="SortByTime"
/>


permanently delete files

Step1: Press windows key + R

Step2: type CMD

Step3: type cipher/w:c:\

Step4: Press Enter 

IE10 renders in IE7 mode. How to force Standards mode?

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-UA-Compatible" value="IE=edge" />
      </customHeaders>
    </httpProtocol>
</system.webServer>

Search This Blog

Arsip Blog

Powered by Blogger.

Recent

Comment

Author Info

Like This Theme

Popular Posts

Video Of Day

Sponsor

Most Popular