﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>kk commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>try this
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment13</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment13</guid><pubDate>Tue, 02 Dec 2008 09:00:33 GMT</pubDate></item><item><title>Kevin Zink commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>Hey Everyone,
  
  
I put together a rough framework which allows you to render views to a string from a controller method in MVC Beta. 
  
  
Additionally, I also put together a Rails-like RJS javascript generating framework for MVC Beta.
  
  
Check it out at 
[www.brightmix.com/.../how-to-renderpartial-to-s...](http://www.brightmix.com/blog/how-to-renderpartial-to-string-in-asp-net-mvc) and let me know what you think.
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment12</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment12</guid><pubDate>Sun, 16 Nov 2008 23:25:26 GMT</pubDate></item><item><title>Endif commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>I spent a few hours on the same problem (see 
[http://forums.asp.net/t/1315284.aspx](http://forums.asp.net/t/1315284.aspx)) and it's pretty disappointing to hear it cannot be fixed for RTM :-(
  
  
@Haacked: Isn't there a way to "hack" it with some output caching? Something like BlockRenderer (see the link) does?
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment11</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment11</guid><pubDate>Thu, 13 Nov 2008 09:51:51 GMT</pubDate></item><item><title>Harry commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>It has taken me a long time to find this answer.
  
Wow what a waste of time (+4 hours of hacking and searching).
  
  
I wish there was better documentation for ASP.net (I know it's beta - but i'm impatient :) )
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment10</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment10</guid><pubDate>Thu, 13 Nov 2008 05:19:45 GMT</pubDate></item><item><title>Steve Wagner commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>I am agree with Ayende. When its not possible to do it, it should throw a exception instead of letting me standing in the rain. 
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment9</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment9</guid><pubDate>Wed, 12 Nov 2008 15:41:29 GMT</pubDate></item><item><title>Torkel commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>Ayende, 
  
  
use the Spark view engine :) 
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment8</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment8</guid><pubDate>Wed, 12 Nov 2008 08:52:14 GMT</pubDate></item><item><title>Frans Bouma commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>I might be wrong, but isn't this still in beta? If so, why are you doing production work on this?
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment7</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment7</guid><pubDate>Wed, 12 Nov 2008 08:35:39 GMT</pubDate></item><item><title>Ayende Rahien commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>Phil,
  
This means that I cannot get the view into a string.
  
That is a PROBLEM.
  
This is so because this is an incredibly common thing to do when you are playing around with composable apps and manipulating views.
  
  
At the very least, this should throw an exception about this being not supported.
  
Or, much better (from my point of view), is to get the framework to fake the pipeline in order to support it.
  
  
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment6</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment6</guid><pubDate>Wed, 12 Nov 2008 03:32:42 GMT</pubDate></item><item><title>Simone commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>@Haacked: maybe a compromise?
  
I mean, when the writer parameter is the Response then you do nothing and go like now, so no possible performances hits.
  
When the writer parameter is a custom one you change the response output stream calling the HttpResponse's private method "SwitchWriter" (using reflection) to supply the custom writer.
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment5</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment5</guid><pubDate>Tue, 11 Nov 2008 22:36:11 GMT</pubDate></item><item><title>Haacked commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>This is one of them tough decisions we had due to the nature of the framework we're building on. It's less than ideal, but is for the greater good eventually.
  
  
Yes, the WebFormViewEngine ignores the writer parameter. We exposed the parameter in the underlying API to encourage *other* view engine implementors to do the right thing and write to the writer as they render the output rather  than creating one big string that they write out at the end. In part, this was to make sure that RenderPartial would work with other view engines.
  
  
Unfortunately, we can't change our own view engine to do this same thing as that would require changes to core bits of the Page class etc... MVC is built on top of ASP.NET core and we can't make changes to the core for MVC right now. Maybe when the next major framework release comes out, we can actually fix this.
  
  
However, since the WebFormViewEngine already streams output to the writer rather than generating one big string, it doesn't suffer the key problem we wanted to solve.
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment4</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment4</guid><pubDate>Tue, 11 Nov 2008 22:17:37 GMT</pubDate></item><item><title>Simone commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>OMG!!!!
  
The WebFormView doesn't do anything with the writer parameter, it just swallows it....
  
that really a bug... even tho I think it cannot be changed since the webviewengine is based on the webform model.
  
One more reason not to use the WebFormViewEngine :)
  
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment3</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment3</guid><pubDate>Tue, 11 Nov 2008 22:04:10 GMT</pubDate></item><item><title>Ayende Rahien commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>Try to execute my code. 
  
You are going through a different code path. 
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment2</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment2</guid><pubDate>Tue, 11 Nov 2008 21:56:23 GMT</pubDate></item><item><title>Simone commented on Another ASP.Net MVC bug: Rendering views to different output source</title><description>That's weird, when you supply your own textwriter the render method of the view should write to it.
  
It's used in testing views as well.
  
  
In my testing code there is:
  
  
            MyTextView view = new MyTextView (templatePath);
  
            StringWriter writer = new StringWriter();
  
            view.Render(null, writer);
  
            string rendered = writer.ToString();
  
  
And it works correctly, at least inside a test case.
</description><link>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment1</link><guid>http://ayende.com/3687/another-asp-net-mvc-bug-rendering-views-to-different-output-source#comment1</guid><pubDate>Tue, 11 Nov 2008 21:43:42 GMT</pubDate></item></channel></rss>