httpcontext instances controllers zero asp.net mvc
this competence repremand proceed controllers, nonetheless i notice problem hadn't figured out proceed repremand it.
public jsonresult somecontrolleraction() {
//the tide slight httpcontext only fine
bool currentisnotnull = (this.httpcontext == null); //which fake
//creating new instance another controller
someothercontroller controller = new someothercontroller();
bool isnull = (controller.httpcontext == null); // true
//the tangible httpcontext glorious both
bool notnull = (system.web.httpcontext.current == null); // fake
}
i've beheld httpcontext controller isn't "actual" httpcontext system.web.httpcontext.current.
is there proceed manually stock httpcontextbase controller? improved proceed emanate an instance controller?
Comments
Post a Comment