1
我使用HttpRuntime.ProcessRequest
方法来渲染IIS以外的ASPX页面,当我的ASPX页面呈现HTML时,所有工作都正常。HttpRuntime.ProcessRequest和“ContentType”页面指令
但是,我也有ASPX页面呈现XML,因此将ContentType
Page指令设置为text/xml
。问题是ProcessRequest
方法只返回一个表示内容的字符串,因此无法将Response中的ContentType设置为Page指令中指示的值。
如何从页面指令中获取ContentType
值到ContentType
值Response
?
您可以使用[SendKnownResponseHeader](http://msdn.microsoft.com/zh-cn/library/system.web.httpworkerrequest.sendknownresponseheader.aspx)并将它传递给[HeaderContentType](http:// msdn.microsoft.com/en-us/library/system.web.httpworkerrequest.headercontenttype.aspx)或者你是否已经尝试过? – R0MANARMY