views:

29

answers:

2

I have created an ASP.NET MVC View. On my MVC WebApp, it works great.

I would like to be able to (from a console app) render the View out as an HTML Email. I'm wondering what the best way to do this is going to be, the part I'm struggling with is Rendering the View.

Is there any way to do this from a console application?

The webapp simply calls a web-service and formats the data nicely so the console application will have access to the same web-service; however, the ActionResult on the controller is protected by [Authorize] attributes, so not just anyone can get at it.

+2  A: 

Yes you can. I assume you are using forms authentication. Just authenticate, grab the session header cookie and copy it to your new web request.

Aliostad
I've never done this before, any resources on doing that? Do I simply add a `NetworkCredentials` on to my WebRequest class?
Nate Bross
Only if you are using Windows authentication.
Aliostad
I am using Forms Authentication. With a plain [Authorize] attribute on the ActionResult...
Nate Bross
Let me get home I will get back to you
Aliostad