That would look like that
public string GetAsString(string actionName, string
controllerName, IDictionary parameters)
{
var client = new WebClient();
var url = new UrlHelper(Context);
var result = client.DownloadString(
url.For(new Dictionary<string, object>
{{"controller", controllerName},
{"action", actionName}, {"querystring", parameters}}));
return result;
}
but I cannot use this anyway, because I'd loose all context (who is my
current user, is he authenticated, etc), because basically this would
be a browser on the server browsing its own pages.
It might help to illustrate what I would like, though...
On Fri, Sep 26, 2008 at 10:10 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
> I don't know... do I? I just want the result from a call to a
> controller, an action with some parameters to be a string. I even
> thought about somehow capturing the output stream via WebClient, but
> this does not seem very good in terms of performance...
>
>
> On Fri, Sep 26, 2008 at 10:03 PM, Mike Nichols <[EMAIL PROTECTED]> wrote:
>>
>> Are you talking about something like an TransformFilter
>> implementation ?
>>
>> On Sep 26, 5:54 pm, "Jan Limpens" <[EMAIL PROTECTED]> wrote:
>>> From a controller I would like to call something like
>>> RenderToString(string controllerName, string actionName, IDictionary
>>> parameters)
>>> and get the equivalent to what would be written to the output stream,
>>> if I had done a Redirect with the same parameters, as a string.
>>>
>>> I tried to read the castle source but it is quite winded and abstract
>>> in these parts, so I did not come up with something. Probably this
>>> functionality is already there in the framework. Anybody could tell me
>>> which strings to pull?
>>>
>>> --
>>> Jan
>>> ___________________
>>> [EMAIL PROTECTED]
>>> +55 (11) 3082-1087
>>> +55 (11) 3097-8339
>> >>
>>
>
>
>
> --
> Jan
> ___________________
> [EMAIL PROTECTED]
> www.limpens.com
> +55 (11) 3082-1087
> +55 (11) 3097-8339
>
--
Jan
___________________
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---