本文整理汇总了C#中IHttpContext.WriteFile方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpContext.WriteFile方法的具体用法?C# IHttpContext.WriteFile怎么用?C# IHttpContext.WriteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpContext
的用法示例。
在下文中一共展示了IHttpContext.WriteFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Respond
public override void Respond(IHttpContext context)
{
if(notifiedAboutSilverlightBeingRequested == false)
{
lock (this)
{
if (notifiedAboutSilverlightBeingRequested == false &&
SilverlightRequestedAware != null)
SilverlightRequestedAware.SilverlightWasRequested(ResourceStore);
notifiedAboutSilverlightBeingRequested = true;
}
}
var match = urlMatcher.Match(context.GetRequestUrl());
var fileName = match.Groups[1].Value;
var paths = GetPaths(fileName);
var matchingPath = paths.FirstOrDefault(File.Exists);
if (matchingPath != null)
{
context.WriteFile(matchingPath);
return;
}
context.SetStatusToNotFound();
}
示例2: Respond
public override void Respond(IHttpContext context)
{
Database.ExtensionsState.GetOrAdd("SilverlightUI.NotifiedAboutSilverlightBeingRequested", s =>
{
foreach (var silverlightRequestedAware in SilverlightRequestedAware)
{
silverlightRequestedAware.Value.SilverlightWasRequested(Database);
}
return true;
});
var match = urlMatcher.Match(context.GetRequestUrl());
var fileName = match.Groups[1].Value;
var paths = GetPaths(fileName, Database.Configuration.WebDir);
var matchingPath = paths.FirstOrDefault(path =>
{
try
{
return File.Exists(path);
}
catch (Exception)
{
return false;
}
});
if (matchingPath != null)
{
context.WriteFile(matchingPath);
return;
}
context.WriteEmbeddedFile(Settings.WebDir, "Raven.Studio.xap");
}
示例3: Respond
public override void Respond(IHttpContext context)
{
var match = urlMatcher.Match(context.GetRequestUrl());
var pluginUrl = match.Groups[1].Value + ".xap";
var dir = ResourceStore.Configuration.PluginsDirectory;
var path = Path.Combine(dir, pluginUrl);
if (File.Exists(path))
{
context.WriteFile(path);
}
else
{
context.SetStatusToNotFound();
}
}
示例4: Respond
public override void Respond(IHttpContext context)
{
ResourceStore.ExternalState.GetOrAdd("SilverlightUI.NotifiedAboutSilverlightBeingRequested", s =>
{
if (SilverlightRequestedAware != null)
SilverlightRequestedAware.SilverlightWasRequested(ResourceStore);
return true;
});
var match = urlMatcher.Match(context.GetRequestUrl());
var fileName = match.Groups[1].Value;
var paths = GetPaths(fileName);
var matchingPath = paths.FirstOrDefault(File.Exists);
if (matchingPath != null)
{
context.WriteFile(matchingPath);
return;
}
context.SetStatusToNotFound();
}
示例5: Respond
public override void Respond(IHttpContext context)
{
ResourceStore.ExtensionsState.GetOrAddAtomically("SilverlightUI.NotifiedAboutSilverlightBeingRequested", s =>
{
foreach (var silverlightRequestedAware in SilverlightRequestedAware)
{
silverlightRequestedAware.Value.SilverlightWasRequested(ResourceStore);
}
return true;
});
var match = urlMatcher.Match(context.GetRequestUrl());
var fileName = match.Groups[1].Value;
var paths = GetPaths(fileName, ResourceStore.Configuration.WebDir);
var matchingPath = paths.FirstOrDefault(File.Exists);
if (matchingPath != null)
{
context.WriteFile(matchingPath);
return;
}
context.SetStatusToNotFound();
}