I am answering my questions.
After reviewing @SimonDoy comment that "That's strange" and realized I am really making some mistake and then realize mistake.
I made mistake, I was running with elevated permission and within that I was referencing SPContext.Current.
The error code
public void ProcessRequest(HttpContext context) { SPSecurity.RunWithElevatedPrivileges(delegate { // 'SPContext.Current' null reference error using (var site = new SPSite(SPContext.Current.Site.ID)) { using (var web = site.OpenWeb(SPContext.Current.Web.ID)) { // codes goes here } } }); }
The fixed code
public void ProcessRequest(HttpContext context) { var curSite = SPContext.Current.Site; var curWeb = SPContext.Current.Web; SPSecurity.RunWithElevatedPrivileges(delegate { using (var site = new SPSite(curSite.ID)) { using (var web = site.OpenWeb(curWeb.ID)) { // code goes here } } }); }