Home > DeveloperSection > Forums > How to get .NET HttpContext for isolated code block
john rob

Total Post:108

Posted on    August-27-2014 1:36 AM


 1 Reply(s)
 761  View(s)
Rate this:

In .NET is it possible to get the HttpContext of the current page from within an external class?

So, for example in my page test1.aspx codebehind I've got:

    Dim blah As New FeedWriter()


But inside FeedWriter.vb, can I get the HttpContext of test1.aspx? Or would I have to pass it in to Run()? (I'm unwilling to do the latter because FeedWriter implements an interface which will need to be re-written if it's to take arguments)

Sumit Kesarwani

Total Post:378

Posted on    August-27-2014 2:55 AM

Hi John, 

You can use the Current property of the HttpContext class:


Don't want to miss updates? Please click the below button!

Follow MindStick