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


C# HttpResponse.WriteAsync方法代码示例

本文整理汇总了C#中Microsoft.AspNet.Http.HttpResponse.WriteAsync方法的典型用法代码示例。如果您正苦于以下问题:C# HttpResponse.WriteAsync方法的具体用法?C# HttpResponse.WriteAsync怎么用?C# HttpResponse.WriteAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.AspNet.Http.HttpResponse的用法示例。


在下文中一共展示了HttpResponse.WriteAsync方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteResponseBodyAsync

 internal static Task WriteResponseBodyAsync(HttpResponse response, string uid, DateTimeOffset? datetime, TimeSpan? duration, string summary, string description, string location) {
     return response.WriteAsync(
         "BEGIN:VCALENDAR\r\n" +
         "VERSION:2.0\r\n" +
         "BEGIN:VEVENT\r\n" +
         "UID:" + uid + "\r\n" +
         "DTSTART:" + datetime?.ToString(DateTimeFormat) + "\r\n" +
         "DTEND:" + datetime?.Add(duration ?? TimeSpan.Zero).ToString(DateTimeFormat) + "\r\n" +
         "SUMMARY:" + summary + "\r\n" +
         "DESCRIPTION:" + description + "\r\n" +
         "LOCATION:" + location +
         "END:VEVENT\r\n" +
         "END:VCALENDAR\r\n");
 }
开发者ID:migrap,项目名称:Migrap.AspNet.Mvc.Formatters.iCalendar,代码行数:14,代码来源:iCalendarOutputFormatter.cs

示例2: WriteOutput

		public static async Task WriteOutput(HttpResponse Response, string Title, Head.Tag[] HeadTags, string Body) {
			var sb = new StringBuilder();
			sb.Append("<!DOCTYPE html><head><meta charset=\"utf-8\">");
			if (Title != null) {
				sb.Append("<title>" + Title + "</title>");
			}
			if (HeadTags != null) {
				foreach (var a in HeadTags) {
					sb.Append(a.Output());
				}
			}
			sb.Append("</head><body>");
			sb.Append(Body);
			sb.Append("</body></html>");
			await Response.WriteAsync(sb.ToString());
		}
开发者ID:matthewhancock,项目名称:plasticbagfreeportsmouth,代码行数:16,代码来源:Html.cs

示例3: WriteOtherSettingsAsync

 public async Task WriteOtherSettingsAsync(HttpResponse response)
 {
     await response.WriteAsync(
         $"OtherSettings Strings: {string.Join(", ", _otherSettings.Strings)}<br>" +
         $"OtherSettings Numbers: {string.Join(", ", _otherSettings.Numbers)}");
 }
开发者ID:jeffogata,项目名称:aspnet-configuration-04-cli,代码行数:6,代码来源:MyClass.cs

示例4: Json

 private async Task Json(HttpResponse Response, Site.Page Page) {
     Response.ContentType = "text/javascript";
     var s = @"{""title"":""" + Util.Json.Fix(Page.Title) + @""",""description"":""" + Util.Json.Fix(Page.Description) + @""",""header"":""" + Util.Json.Fix(Page.Header) + @""",""key"":""" + Page.Key + @""",""content"":""" + Util.Json.Fix(Page.Content) + @"""}";
     await Response.WriteAsync(s);
 }
开发者ID:matthewhancock,项目名称:dentoncitycouncil,代码行数:5,代码来源:Startup.cs

示例5: Javascript

        private async Task Javascript(HttpResponse Response) {
            Response.Headers.Add(Headers.Cache, Headers.Values.Cache);
            Response.ContentType = "text/javascript";

            if (_javascript == null) {
                _javascript = await Util.File.LoadToString("_files/js/this.js");
            }
            await Response.WriteAsync(_javascript);
        }
开发者ID:matthewhancock,项目名称:dentoncitycouncil,代码行数:9,代码来源:Startup.cs

示例6: Css

        private async Task Css(HttpResponse Response) {
            Response.Headers.Add(Headers.Cache, Headers.Values.Cache);
            Response.ContentType = "text/css";

            if (_css == null) {
                _css = await Util.File.LoadToString("_files/css/this.css");
            }
            await Response.WriteAsync(_css);
        }
开发者ID:matthewhancock,项目名称:dentoncitycouncil,代码行数:9,代码来源:Startup.cs

示例7: WritePageFooter

 private async Task WritePageFooter(HttpResponse response)
 {
     await response.WriteAsync("</body>");
     await response.WriteAsync("</html>");
     //response.Flush();
 }
开发者ID:okusnadi,项目名称:cloudscribe,代码行数:6,代码来源:SetupController.cs

示例8: WritePageHeader

        private async Task WritePageHeader(HttpResponse response)
        {

            string setupTemplatePath = setupOptions.SetupHeaderConfigPath.Replace("/", Path.DirectorySeparatorChar.ToString());
            if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
            {
                setupTemplatePath = setupOptions.SetupHeaderConfigPathRtl.Replace("/", Path.DirectorySeparatorChar.ToString());
            }

            //string fsPath = hostingEnvironment.MapPath(setupTemplatePath);
            string fsPath = appBasePath + setupTemplatePath;

            if (System.IO.File.Exists(fsPath))
            {
                string sHtml = string.Empty;
                using (StreamReader oStreamReader = System.IO.File.OpenText(fsPath))
                {
                    sHtml = oStreamReader.ReadToEnd();
                }
                await response.WriteAsync(sHtml);
            }

            //response.Flush();
        }
开发者ID:okusnadi,项目名称:cloudscribe,代码行数:24,代码来源:SetupController.cs

示例9: WritePageContent

        private async Task WritePageContent(HttpResponse response, string message, bool showTime)
        {

            if (showTime)
            {
                await response.WriteAsync(
                    string.Format("{0} - {1}",
                    message,
                    DateTime.UtcNow.Subtract(startTime)));
            }
            else
            {
                await response.WriteAsync(message);
            }
            await response.WriteAsync("<br/>");
       
            //response.Flush();

        }
开发者ID:okusnadi,项目名称:cloudscribe,代码行数:19,代码来源:SetupController.cs

示例10: WriteErrorToResponse

        private static async Task WriteErrorToResponse(HttpResponse response, string error)
        {
            response.StatusCode = (int)HttpStatusCode.BadRequest;
            response.Headers.Add("Pragma", new[] { "no-cache" });
            response.Headers.Add("Cache-Control", new[] { "no-cache" });
            response.ContentType = "text/plain";

            // Padding to >512 to ensure IE doesn't hide the message
            // http://stackoverflow.com/questions/16741062/what-rules-does-ie-use-to-determine-whether-to-show-the-entity-body
            await response.WriteAsync(error.PadRight(513));
        }
开发者ID:leloulight,项目名称:Diagnostics,代码行数:11,代码来源:MigrationsEndPointMiddleware.cs

示例11: WriteInstalledSchemaSummary

        private async Task WriteInstalledSchemaSummary(HttpResponse response)
        {
            //await WritePageContent(response, message, false);
            List<VersionItem> currentSchemas = await setupManager.GetInstalledSchemaList();
            await response.WriteAsync("<h2>Current Schema Versions</h2>");
            await response.WriteAsync("<ul>");

            string formatString = "<li>{0} - {1}</li>";
            foreach(VersionItem item in currentSchemas)
            {
                string itemMarkup = string.Format(formatString, item.Name, item.CurrentVersion.ToString());
                await response.WriteAsync(itemMarkup);
            }

            await response.WriteAsync("</ul>");

        }
开发者ID:joeaudette,项目名称:cloudscribe.Setup,代码行数:17,代码来源:SetupController.cs

示例12: FileNotFound

 public static async Task FileNotFound(HttpResponse Response) {
     Response.StatusCode = 404;
     await Response.WriteAsync("File Not Found");
 }
开发者ID:matthewhancock,项目名称:plasticbagfreeportsmouth,代码行数:4,代码来源:Startup.cs


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