本文整理汇总了C#中IHttpContext.SetResponse方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpContext.SetResponse方法的具体用法?C# IHttpContext.SetResponse怎么用?C# IHttpContext.SetResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpContext
的用法示例。
在下文中一共展示了IHttpContext.SetResponse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
public virtual void Send(IHttpContext context)
{
context.StatusCode = (int)statusCode;
Encoding encoding = new UTF8Encoding(false);
context.SetResponse(content, contentType, encoding);
}
示例2: Send
public virtual void Send(IHttpContext context)
{
VelocityEngine velocity = new VelocityEngine();
velocity.Init();
VelocityContext velocityContext = new VelocityContext();
if (properties != null)
{
foreach (DictionaryEntry entry in properties)
velocityContext.Put(entry.Key.ToString(), entry.Value);
}
AddStuffToVelocityContext(velocityContext, context);
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
if (false == velocity.Evaluate(velocityContext, stringWriter, null, template.GetTemplate()))
throw new InvalidOperationException("Template expansion failed");
context.SetResponse(stringWriter.GetStringBuilder().ToString(), contentType, Encoding.UTF8);
}
}
示例3: Send
public void Send(IHttpContext context)
{
Encoding encoding = new UTF8Encoding(false);
context.SetResponse(content, HttpConstants.ContentTypeXml, encoding);
}
示例4: Send
public void Send(IHttpContext context)
{
string response = ConstructPageHtml(context);
context.SetResponse(response, HttpConstants.ContentTypeHtml, Encoding.UTF8);
}
示例5: Send
public void Send(IHttpContext context)
{
string fileContents = fileCache.GetFile(fileName);
context.SetResponse(fileContents, contentType, encoding);
}