Server.Execute在类中不起作用 [英] Server.Execute not working in Class
本文介绍了Server.Execute在类中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hiya
我正在尝试在一个类中使用以下代码片段,该类旨在使事情更易于维护:
Hiya
I am trying to use the following fragment of code in a class which is designed to make things easier to maintain:
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Server.Execute("Default.aspx", htw);
该代码构成了电子邮件程序的一部分,该电子邮件程序运行aspx页面并返回原始HTML以便通过电子邮件发送.
但是,它找不到Server.Execute方法.
有人可以提供解决此问题的方法吗?
The code forms part of an emailer which runs the aspx page and returns the raw HTML for emailing.
However, it cannot find the Server.Execute method.
Can anyone offer a solution to this problem?
推荐答案
尝试以下操作:
Hi,
Try this:
System.Web.HttpContext.Current.Server.Execute("Default.aspx", htw);
并确保default.aspx页的文件路径正确:-)
问候
约阿希姆(Joachim)
And be sure the file path to the default.aspx page is correct :-)
Regards
Joachim
这篇关于Server.Execute在类中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文