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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -