In asp.net how do i get the current httpcontext for the page that i am on?
i have tried giving the relevant controller the httpcontext as an argument, but this does not work. I have found plenty of people describing how to specify the object , but i simply cannot find any info on how the httpcontext should be added to the controller (like, in a argument or so)
this does not work
public class MovieController : Controller
{
public ActionResult Random(HttpContext mycontext)
{
RandomMovieViewmodel rmvm = new RandomMovieViewmodel();
return View(rmvm);
}
How do i acces the context? should I maybe make a attribute?
Random
method fromHttpContext
or ratherController
? – Eada