You cannot use Response.write directly in class files. You need to use System.Web.httpContext.current.Response.write to call.