c# - Difference Output between Debug and Release version in ASP Application -
i've written following code in application
fs = new filestream(outputfilepath, filemode.createnew, fileaccess.readwrite, fileshare.read); stringbuilder sb = new stringbuilder(); using (streamwriter writer = new streamwriter(fs, encoding.utf8, 512)) { //add text sb writer.write(sb.tostring()); writer.close(); } { if (fs != null) { fs.close(); fs.dispose(); }
now when use application , click on output button, output file has html code of using page after desired output. when use debug tool find wrong code, every thing perfect! output file!
edit: here output
debug version(right output)
//exact text added sb above
release version(wrong output)
//exact text added sb above <!doctype html ....//all html code of using page download output file
excuse me grammar mistakes, english not native language.
i suspect want along these lines:
stringbuilder sb = new stringbuilder(); sb.add("some text"); // clear page has begun buffer. don't want that. response.clearheaders(); response.clearcontent(); // write response.outputstream here response.contenttype = "text/plain"; response.charset = "utf-8"; response.outputstream.write(system.text.encoding.utf8.getbytes(sb.tostring())); // send client immediately. response.flush(); // prevent more being added asp.net response.suppresscontent = true;
Comments
Post a Comment