예제 #1
0
        /// <summary>
        ///         ''' Try to retrieve meta description and title from the url specified
        ///         ''' </summary>
        ///         ''' <param name="sender"></param>
        ///         ''' <param name="e"></param>
        ///         ''' <remarks></remarks>
        ///         ''' <history>
        ///         '''     [alex]      10/02/2009   First implementation
        ///         ''' </history>
        protected void lbtGetContent_Click(object sender, System.EventArgs e)
        {
            string targetUrl = this.ctlURL.Url;

            if (!string.IsNullOrEmpty(targetUrl))
            {
                string retrieveMessage         = Localization.GetString("msgGetContentSucceeded.Text", this.LocalResourceFile);
                string retrieveMessageCssClass = "MessageSuccees";

                try
                {
                    // get content from target url
                    TargetInfo targetInfo = LinkController.GetTargetContent(targetUrl);

                    this.txtTitle.Text       = targetInfo.Title;
                    this.txtDescription.Text = targetInfo.Description;
                }
                catch (System.Net.WebException)
                {
                    retrieveMessage         = Localization.GetString("msgGetContentFailed.Text", this.LocalResourceFile);
                    retrieveMessageCssClass = "MessageFailure";
                }

                lblGetContentResult.Text     = retrieveMessage;
                lblGetContentResult.CssClass = retrieveMessageCssClass;

                valTitle.Validate();
            }
        }