Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - How to send a Status Code 500 in ASP.Net and still write to the response? -


i have asp.net single-file web service (a .ashx file containing ihttphandler implementation) needs able return errors responses 500 internal server error status codes. relatively straightforward thing in php:

header("http/1.1 500 internal server error"); header("content-type: text/plain"); echo "unable connect database on $dbhost"; 

the asp.net (c#) equivalent should be:

context.response.statuscode = (int)httpstatuscode.internalservererror; context.response.contenttype = "text/plain"; context.response.write("unable connect database on " + dbhost); 

of course, doesn't work expected; instead, iis intercepts 500 status code, trashes whatever i've written response object, , sends either debug info or custom error page, depending on how app configured.

my question - how can suppress iis behaviour , send error information directly ihttphandler implementation?

this app port php; client-side written, i'm stuck spec. sending errors 200 status code sadly doesn't fit mould.

ideally, need control behaviour programmatically, because part of sdk want distribute without "edit file" , "change iis setting" supplementary instructions.

thanks!

edit: sorted. context.response.tryskipiiscustomerrors = true ticket. wow.

context.response.tryskipiiscustomerrors = true


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -