简体   繁体   中英

Using HttpContext for InfoPath 2007 codebehind

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 ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM