Pergunta

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.

Foi útil?

Solução

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 ?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top