I upgraded a project I did in Visual Studio 2008 to VS 2010 and now the following line won't compile
using (TextWriter textWriter = new StreamWriter(_viewContext.HttpContext.Response.OutputStream))
{
textWriter.Write(_tag.ToString(TagRenderMode.EndTag));
}
The error message I'm getting is:
OutputStream is not available when a custom TextWriter is used.
Can anyone fill me in on what I need to do? Thanks
Edit : the target framework is .Net 3.5
If you have the option of changing the code, try this instead:
using (StreamWriter sw = new StreamWriter(_viewContext.HttpContext.Response.OutputStream))
{
using (TextWriter textWriter = TextWriter.Synchronized(sw))
{
textWriter.Write(_tag.ToString(TagRenderMode.EndTag));
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.