문제

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.

도움이 되었습니까?

해결책

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 ?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top