• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WebPage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WebPage的典型用法代码示例。如果您正苦于以下问题:C# WebPage类的具体用法?C# WebPage怎么用?C# WebPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WebPage类属于命名空间,在下文中一共展示了WebPage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PiranhaHelper

 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="html"></param>
 public PiranhaHelper(WebPage parent, HtmlHelper html)
 {
     Parent = parent ;
     Html = html ;
     Gravatar = new GravatarHelper() ;
     Culture = new CultureHelper() ;
 }
开发者ID:NJepop,项目名称:Piranha,代码行数:11,代码来源:PiranhaHelper.cs


示例2: TestWebPage

 public void TestWebPage()
 {
     var page = new WebPage<MyPage>("http://ya.ru", "<html><html>")
     {
         FuncParse = () => new MyPage {Id = 1, Title = "Test page"}
     };
     Assert.AreEqual(new MyPage {Id = 1, Title = "Test page"}, page.Model);
 }
开发者ID:ibavca1,项目名称:bavc.ru,代码行数:8,代码来源:UnitTestPage.cs


示例3: Search

 public void Search(string website, string regexPattern)
 {
     List<string> output = new List<string>();
     _regexPattern = regexPattern;
     webpage = new WebPage();
     webpage.WebPageLoaded += WebPageLoadedSearchCalled;
     webpage.Load(website);
 }
开发者ID:conradkoh,项目名称:Buddy,代码行数:8,代码来源:TorrentSearcher.cs


示例4: ExtractList

 /// <summary>
 /// Extract from the web page and return the results as a list.
 /// </summary>
 /// <param name="page">The web page to extract from.</param>
 /// <returns>The results of the extraction as a List.</returns>
 public IList<Object> ExtractList(WebPage page)
 {
     Listeners.Clear();
     var listener = new ListExtractListener();
     AddListener(listener);
     Extract(page);
     return listener.List;
 }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:13,代码来源:BasicExtract.cs


示例5: WebPageDecorator

 /// <summary>
 /// Initializes a new instance of the WebPageDecorator class
 /// </summary>
 /// <param name="webPage">The web page model.</param>
 /// <param name="context">The data context.</param>
 public WebPageDecorator(WebPage webPage, IDataContext context)
 {
     if (webPage is WebPageDecorator)
         Model = ((WebPageDecorator)webPage).Model;
     else
         Model = webPage;
     this.Context = context;
     Model.CopyTo(this, new string[] { "Widgets", "Roles", "Scripts", "StyleSheets" });
 }
开发者ID:howej,项目名称:dotnetage,代码行数:14,代码来源:WebPageDecorator.cs


示例6: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            webPage = this.Page as WebPage;

            if (!IsPostBack)
            {
                ltlMenu.Text = webPage.SideMenus;
            }
        }
开发者ID:plz821,项目名称:entCMS,代码行数:9,代码来源:Inside.master.cs


示例7: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page is WebPage)
     {
         webPage = (this.Page as WebPage);
     }
     else
     {
         webPage = new WebPage(1);
     }
 }
开发者ID:plz821,项目名称:entCMS,代码行数:11,代码来源:NestedSite.master.cs


示例8: btnSave_Click

    protected void btnSave_Click(object sender, EventArgs e)
    {
        var page = new WebPage();

        if (IsLoaded)
            page.CopyPropertiesFrom(OriginalPage);

        page.ParentPageId = null;
        if (!String.IsNullOrEmpty(cboParentPages.SelectedValue))
            page.ParentPageId = Convert.ToInt32(cboParentPages.SelectedValue);

        page.Name = txtName.Text;
        page.CompanyId = Company.CompanyId;
        page.Description = txtDescription.Value.Replace("$0", "<br/>");
        page.IsInMenu = chkIsInMenu.Checked;

        page.IsPublished = chkIsPublished.Checked;
        page.CanComment = chkCanComment.Checked;
        page.MasterPage = cboMasterPage.Text;

        if (page.IsPublished)
        {
            if (!page.PublishedDate.HasValue)
                page.PublishedDate = DateTime.Now;
        }
        else
            page.PublishedDate = null;

        page.RedirectUrl = null;
        if (!String.IsNullOrEmpty(txtRedirectUrl.Text))
            page.RedirectUrl = txtRedirectUrl.Text;

        page.ModifiedDate = DateTime.Now;

        if (!page.UserId.HasValue)
            page.UserId = User.Identity.UserId;

        SiteManager.Save(page, txtTags.Text);

        if (((WebControl)sender).ID == "btnSaveAndNew")
        {
            Response.Redirect("WebPage.aspx");
            return;
        }
        //
        //Close the modal popup and redirect for WebPages.aspx
        //
        ClientScript.RegisterStartupScript(this.GetType(), "close", "top.$.LightboxObject.close();", true);

        //Response.Redirect("WebPages.aspx");

    }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:52,代码来源:WebPage.aspx.cs


示例9: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page is WebPage)
     {
         webPage = (this.Page as WebPage);
     }
     else
     {
         webPage = new WebPage(1);
     }
     Page.Title = webPage.WebName;
     ltlKeyword.Text = "<meta name=\"keywords\" content=\"" + webPage.Keywords + "\"/>";
     ltlDescription.Text = "<meta name=\"description\" content=\"" + webPage.Description + "\"/>";
 }
开发者ID:plz821,项目名称:entCMS,代码行数:14,代码来源:Site.Master.cs


示例10: Main

        static void Main(string[] args)
        {
            WebPage webInfo = new WebPage("http://zhan.renren.com/flipped2012/more?page=1&count=20");
            //"http://zhan.renren.com/ranzhi12/more?page=1&count=20"

            string context = webInfo.Context;
            string html = webInfo.M_html;

            List<Link> result = webInfo.Links;
            IEnumerable<IGrouping<string,Link>> tmp = result.GroupBy(o => o.Tag);
            //var tmp2 = result.Where(o => o.Tag == "img" & (o.Src.IndexOf("xlarge") > -1 || o.Src.IndexOf("original") > -1)).ToList();

            var imgs = result.Where(o => o.Tag == "img").ToList();
        }
开发者ID:priceLiu,项目名称:GetWebPage,代码行数:14,代码来源:Program.cs


示例11: RenderWebPage

        public static string RenderWebPage(WebPage page, StartPage startPage = null) {
            var writer = new StringWriter();

            // Create an actual dummy HttpContext that has a request object
            var filename = "default.aspx";
            var url = "http://localhost/default.aspx";
            var request = new HttpRequest(filename, url, null);
            var httpContext = new HttpContext(request, new HttpResponse(new StringWriter(new StringBuilder())));

            var pageContext = Util.CreatePageContext(httpContext);

            page.ExecutePageHierarchy(pageContext, writer, startPage);

            return writer.ToString();
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:15,代码来源:Utils.cs


示例12: RenderWebPage

        public static string RenderWebPage(WebPage page, StartPage startPage = null, HttpRequestBase request = null)
        {
            var writer = new StringWriter();

            // Create an actual dummy HttpContext that has a request object
            var filename = "default.aspx";
            var url = "http://localhost/default.aspx";

            request = request ?? CreateTestRequest(filename, url).Object;
            var httpContext = CreateTestContext(request);

            var pageContext = new WebPageContext { HttpContext = httpContext.Object };
            page.ExecutePageHierarchy(pageContext, writer, startPage);
            return writer.ToString();
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:15,代码来源:Utils.cs


示例13: WebPageHttpHandler

        public WebPageHttpHandler(string virtualPath)
        {
            // create a new WebPage instance for use when processing the request
            this.Page = (WebPage)WebPageBase.CreateInstanceFromVirtualPath(virtualPath);

            Func<WebPageRenderingBase> func = null;
            if (func == null)
            {
                func = delegate
                {
                    return StartPage.GetStartPage(this.Page, "_PageStart", System.Web.WebPages.WebPageHttpHandler.GetRegisteredExtensions());
                };
            }
            this._startPage = new Lazy<WebPageRenderingBase>(func);
        }
开发者ID:perezdecolosia,项目名称:Northwind.Web.WebPages,代码行数:15,代码来源:WebPageHttpHandler.cs


示例14: WebPageLoadedSearchCalled

        private void WebPageLoadedSearchCalled(object sender, WebPage.WebPageArguments args)
        {
            string htmlData = webpage.htmlData;
            if (htmlData != null)
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(_regexPattern);
                results = regex.Matches(htmlData);

            }
            if(InfoReady != null)
            {
                InfoReady(this, new InfoReadyEventArgs("info ready"));
            }

               // webpage.WebPageLoaded -= WebPageLoadedSearchCalled;
        }
开发者ID:conradkoh,项目名称:Buddy,代码行数:16,代码来源:TorrentSearcher.cs


示例15: InjectContext

        public static void InjectContext(WebPage razorWebPage, MacroModel macro, INode currentPage) {
            var context = HttpContext.Current;
            var contextWrapper = new HttpContextWrapper(context);

            //inject http context - for request response
            HttpContext.Current.Trace.Write("umbracoMacro", string.Format("Loading Macro Script Context (file: {0})", macro.Name));
            razorWebPage.Context = contextWrapper;
            HttpContext.Current.Trace.Write("umbracoMacro", string.Format("Done Loading Macro Script Context (file: {0})", macro.Name));

            //Inject Macro Model And Parameters
            if (razorWebPage is IMacroContext) {
                HttpContext.Current.Trace.Write("umbracoMacro", string.Format("Boxing Macro Script MacroContext (file: {0})", macro.Name));
                var razorMacro = (IMacroContext)razorWebPage;
                HttpContext.Current.Trace.Write("umbracoMacro", string.Format("Done Boxing Macro Script MacroContext (file: {0})", macro.Name));

                HttpContext.Current.Trace.Write("umbracoMacro", string.Format("Loading Macro Script Model (file: {0})", macro.Name));
                razorMacro.SetMembers(macro, currentPage);
                HttpContext.Current.Trace.Write("umbracoMacro", string.Format("Done Loading Macro Script Model (file: {0})", macro.Name));
            }
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:20,代码来源:RazorMacroEngine.cs


示例16: foo

        void foo(string s)
        {
            WebPage p1 = new WebPage();
                                MyWebPage p2 = new MyWebPage();

                                p1.foo();
                                p2.foo();

                                a=3;b=4;c=5;
                                if (s > "xyz")
                                {
                                                foo("hello");
                                }
                                if (s <= "xyz")
                                {
                                                print("good");
                                                print("bye");
                                }
                                if (x==y)
                                                print("z");
        }
开发者ID:drequil,项目名称:DemoCS,代码行数:21,代码来源:Demo.cs


示例17: ValidatePage

 public void ValidatePage(Page page, WebPage webPage)
 {
   ValidateTag(page, webPage, new Regex(DocPageValidatorResources.OwnerRegex),
     DocPageValidatorResources.OwnerTagName, 
     DocPageValidatorResources.OwnerTagSelector, 
     DocPageValidatorResources.MultipleOwnerTagsErrorType, 
     DocPageValidatorResources.MultipleOwnerTagsErrorMessage,
     DocPageValidatorResources.ImproperOwnerTagErrorType, 
     DocPageValidatorResources.ImproperOwnerTagErrorMessage);
   ValidateTag(page, webPage, new Regex(DocPageValidatorResources.ReviewerRegex), 
     DocPageValidatorResources.ReviewerTagName, 
     DocPageValidatorResources.ReviewerTagSelector,
     DocPageValidatorResources.MultipleReviewerTagsErrorType, 
     DocPageValidatorResources.MultipleReviewerTagsErrorMessage,
     DocPageValidatorResources.ImproperReviewerTagErrorType, 
     DocPageValidatorResources.ImproperReviewerTagErrorMessage);
   ValidateUpdatedOrReviewed(page, webPage, DocPageValidatorResources.UpdatedTagName);
   ValidateUpdatedOrReviewed(page, webPage, DocPageValidatorResources.ReviewedTagName);
   ValidateReviewedAfterUpdated(page);
   ValidateReviewedAfterOldestAllowedDate(page);
   ValidateTitle(page, webPage);
 }
开发者ID:szwork2013,项目名称:BoiPlt,代码行数:22,代码来源:DocPageValidator.cs


示例18: CreateMethodParameters

        private static object[] CreateMethodParameters(WebPage page, ParameterInfo[] parameters)
        {
            var eventArgument = page.Request["__event_argument"];
            var objects = new object[parameters.Length];

            if (!string.IsNullOrWhiteSpace(eventArgument))
            {
                var argumentData = eventArgument.Split(',');

                for (int i = 0; i < parameters.Length && i < argumentData.Length; i++)
                {
                    objects[i] = Convert.ChangeType(argumentData[i], parameters[i].ParameterType);
                }
            }
            else
            {
                for (int i = 0; i < parameters.Length; i++)
                {
                    var name = parameters[i].Name;
                    if (page.Request[name] != null)
                    {
                        objects[i] = Convert.ChangeType(page.Request[name], parameters[i].ParameterType);
                    }
                    else if (name == "urlData" || parameters[i].ParameterType == typeof(string[]))
                    {
                        objects[i] = page.UrlData.ToArray();
                    }
                    else if (name == "request" || parameters[i].ParameterType == typeof(HttpRequest))
                    {
                        objects[i] = page.Request;
                    }
                    else if (parameters[i].ParameterType == typeof(ExpandoObject))
                    {
                        objects[i] = page.Request.Form.ToDynamic();
                    }
                }
            }
            return objects;
        }
开发者ID:yysun,项目名称:Rabbit,代码行数:39,代码来源:WebPageExtensions.cs


示例19: FetchURL

        /// <summary>
        /// Fetches the page a URL refers to, and returns a WebPage struct.
        /// </summary>
        /// <param name="url">The URL to fetch.</param>
        /// <returns>A WebPage struct containing the domain and the page itself.</returns>
        public static WebPage FetchURL(string url)
        {
            try
            {
                ServicePointManager.ServerCertificateValidationCallback = CheckValidationResult;

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1";
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                if (Regex.IsMatch(response.ContentType, @"^(text/.*|application/((rss|atom|rdf)\+)?xml(;.*)?)$"))
                {
                    Stream responseStream = response.GetResponseStream();
                    System.Text.Encoding encode = System.Text.Encoding.UTF8;
                    StreamReader stream = new StreamReader(responseStream, encode);

                    StringBuilder sb = new StringBuilder();

                    sb.Append(stream.ReadToEnd());

                    WebPage webPage = new WebPage();

                    webPage.Domain = response.ResponseUri.Scheme + "://" + response.ResponseUri.Host;
                    webPage.Page = sb.ToString();

                    response.Close();
                    stream.Close();

                    return webPage;
                }

                return new WebPage();
            }
            catch (System.Exception ex)
            {
                // Propagate exceptions upwards
                throw ex;
            }
        }
开发者ID:MatthewCox,项目名称:MoronBot,代码行数:44,代码来源:URL.cs


示例20: Input

 /// <summary>
 /// Construct this Input element.
 /// </summary>
 /// <param name="source">The source for this input ent.</param>
 public Input(WebPage source)
     : base(source)
 {
 }
开发者ID:CreativelyMe,项目名称:encog-dotnet-core,代码行数:8,代码来源:Input.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebParameterCollection类代码示例发布时间:2022-05-24
下一篇:
C# WebMediaType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap