0

I want to know the difference between HttpContext.Current.Response and Context.Response and when I should be used and which is better.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Anton
  • 63
  • 4
  • possible duplicate of [HttpContext.Current.Session vs Context.Session](http://stackoverflow.com/questions/14207775/httpcontext-current-session-vs-context-session) – Ant P Jan 12 '14 at 17:24
  • Which `Context.Response` do you actually mean? – Ondrej Tucny Jan 12 '14 at 17:25

3 Answers3

2

There is no difference. Some classes, e.g. Page provide a property Context that returns HttpContext.Current and can be used as a short form.

Markus
  • 20,838
  • 4
  • 31
  • 55
2

Those are just different ways to access the same object.

The Context property is available inside some objects. If your code is not within one of those objects, you can use the static HttpContext.Current property to access the current context.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
1

No difference at all. It's the same object, but accessed differently.

realnero
  • 994
  • 6
  • 12