Thursday, March 14, 2013

Tuesday, March 12, 2013

How to read cookie value in ASP.NET MVC razor view?

@Request.Cookies["cookiename"].Value

@Response.Cookies["cookiename"].Value

Monday, March 11, 2013

ASP.NET Web API REST Security Basic

http://www.jamiekurtz.com/2013/01/14/asp-net-web-api-security-basics/

Thursday, March 7, 2013

How to keep ASP.NET application "alive" ?

There is one event call, Application_End in Global.asax. It happens when IIS application pool is recycled or the application itself is unloaded.
So add one call to self website to make application running again.

        protected void Application_End(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(1000);
            try
            {
                WebClient http = new WebClient();
                string Result = http.DownloadString(yourwebsiteurl);
            }
            catch (Exception ex)
            {
                string Message = ex.Message;
            }
        }