Sunday, 15 July 2012

asp.net mvc - No body rendered while returning contentresult in Episerver CMS 7 -



asp.net mvc - No body rendered while returning contentresult in Episerver CMS 7 -

i've problem returning contentresult in episerver 7 site. problem occur on test-server while local environment works properly.

the code:

public actionresult index(int statuscode, string message) { ... unrelevant code..... homecoming new extendedcontentresult { statuscode = 401, content = mvchtmlstring.create("bananas test text").tostring(), contentencoding = encoding.utf8, contenttype = "text/html", headers = response.headers }; } public class extendedcontentresult : contentresult { public int statuscode { get; set; } public namevaluecollection headers { get; set; } public override void executeresult(controllercontext context) { context.httpcontext.response.statuscode = statuscode; foreach (string s in headers.keys) { context.httpcontext.response.addheader(s, headers[s]); } base.executeresult(context); } }

the result differ on test versus dev. on dev env. expected result: 401 "bananas test text" written on screen. on test-server 401, don't content on element.

what can cause of behavior? check?

thanks in advance

edit: solved. in web.config, had set custom-errors mode=off:

what had missed setting globalerrorhandling-property in webconfig episerver off, like:

asp.net-mvc episerver

No comments:

Post a Comment