当前位置: 首页>>代码示例>>C#>>正文


C# IHttpContext.WriteFile方法代码示例

本文整理汇总了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();
		}
开发者ID:guidmaster,项目名称:ravendb,代码行数:25,代码来源:SilverlightUI.cs

示例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");
		}
开发者ID:925coder,项目名称:ravendb,代码行数:32,代码来源:SilverlightUI.cs

示例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();
			}
		}
开发者ID:nhsevidence,项目名称:ravendb,代码行数:17,代码来源:SilverlightPlugin.cs

示例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();
		}
开发者ID:philiphoy,项目名称:ravendb,代码行数:20,代码来源:SilverlightUI.cs

示例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();
		}
开发者ID:neiz,项目名称:ravendb,代码行数:22,代码来源:SilverlightUI.cs


注:本文中的IHttpContext.WriteFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。