Question

What am I doing wrong here please? I get a NullReferenceException.

string outUrl = "http://whatever.com";
HttpContext context = HttpContext.Current;
context.Response.Redirect(outUrl, false);

When I use new like this:

HttpContext HC = new HttpContext();

I get No Overload for method. I am working with .NET 2 inside VSTA.

Était-ce utile?

La solution

HttpContext is not possible to instanciate and will only be created by your application.

It even really hard to mock (create a fake), Why do you need one ? what is your application type ?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top