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


C# HtmlTextWriter.WriteFullBeginTag方法代码示例

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


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

示例1: HandleError

        /// <include file='doc\WmlPageAdapter.uex' path='docs/doc[@for="WmlPageAdapter.HandleError"]/*' />
        public virtual bool HandleError(Exception e, HtmlTextWriter writer)
        {
            WmlMobileTextWriter wmlWriter = (WmlMobileTextWriter)writer;

            bool renderBackButton = Device.NumberOfSoftkeys > 2 && !Device.HasBackButton;

            //  set mime type, in case init() has not been called yet
            Page.Response.ContentType = _contentType;

            Exception ex;
            if ((e is HttpException && e.InnerException != null) || 
                (e is System.Reflection.TargetInvocationException && e.InnerException != null))
            {
                ex = e.InnerException;
            }
            else
            {
                ex = e;
            }

            if (RequiresUTF8ContentEncoding())
            {
                Page.Response.ContentEncoding = UTF8Encoding;
            }

            wmlWriter.BeginResponse();
            wmlWriter.BeginFile(Page.Request.Url.ToString(), _contentType, Page.Response.Charset);

            RenderXmlHeader(writer);

            // First card.

            writer.WriteFullBeginTag("wml");

            if (Device.SupportsCacheControlMetaTag)
            {
                writer.Write(_cacheExpiry);
            }
            else
            {
                Page.Response.AppendHeader("Cache-Control", "max-age=0");
            }

            writer.WriteFullBeginTag("card");

            writer.WriteFullBeginTag("p");
            writer.WriteFullBeginTag("big");
            writer.WriteFullBeginTag("b");
            wmlWriter.WriteEncodedText(SR.GetString(SR.WmlPageAdapterServerError,
                                       HttpRuntime.AppDomainAppVirtualPath));
            writer.WriteEndTag("b");
            writer.WriteEndTag("big");
            writer.WriteEndTag("p");

            writer.WriteFullBeginTag("p");
            writer.Write("<do type=\"accept\" label=\"");
            writer.Write(GetDefaultLabel(MoreLabel));
            writer.Write("\"><go href=\"#more\" /></do>");
            if (renderBackButton)
            {
                writer.Write("<do type=\"prev\" label=\"");
                writer.Write(GetDefaultLabel(BackLabel));
                writer.WriteLine("\"><prev /></do>");
            }
            wmlWriter.WriteEncodedText(ex.GetType().ToString());
            writer.Write("<br />");
            wmlWriter.WriteEncodedText(ex.Message);
            writer.Write("<br />");
            wmlWriter.WriteEncodedText(SR.GetString(SR.WmlPageAdapterMethod));
            if (ex.TargetSite != null) {
                wmlWriter.WriteEncodedText(ex.TargetSite.Name);
            }
            writer.Write("<br />");
            writer.WriteEndTag("p");

            writer.WriteEndTag("card");

            // Stack trace card.

            writer.Write("<card id=\"more\">");
            writer.Write("<p mode=\"nowrap\">");

            if (renderBackButton)
            {
                writer.Write("<do type=\"prev\" label=\"");
                wmlWriter.WriteEncodedText(GetDefaultLabel(BackLabel));
                writer.WriteLine("\"><prev /></do>");
            }

            String stackTrace = ex.StackTrace;
            if (stackTrace != null) {
                int maximumStackTrace = OptimumPageWeight / 2;
                if (stackTrace.Length > maximumStackTrace)
                {
                    wmlWriter.WriteEncodedText(SR.GetString(SR.WmlPageAdapterStackTrace));
                    writer.Write("<br />");
                    stackTrace = stackTrace.Substring(0, maximumStackTrace);
                }
                else
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:WmlPageAdapter.cs


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