Exemplo n.º 1
0
        protected void buttonSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                SharedBasePage requestPage = Page as SharedBasePage;
                SiteConfig     siteConfig  = requestPage.SiteConfig;

                string userName = requestPage.User.Identity.Name;

                User user = SiteSecurity.GetUser(userName);

                // failed to retrieve the user
                if (user != null)
                {
                    if (textPassword.Text.Length > 0 && textPassword.Text != passwordPlaceHolder)
                    {
                        user.Password = textPassword.Text;
                    }

                    user.EmailAddress       = textEMail.Text;
                    user.NotifyOnNewPost    = checkboxNewPost.Checked;
                    user.NotifyOnAllComment = checkboxAllComment.Checked;
                    user.NotifyOnOwnComment = checkboxOwnComment.Checked;
                    user.DisplayName        = textDisplayName.Text;
                    user.OpenIDUrl          = textOpenIdIdentifier.Text;

                    SiteSecurity.UpdateUser(user);
                }

                SetProfileContent(editControl.Text);
                requestPage.Redirect(Page.Request.Url.AbsoluteUri);
            }
        }
Exemplo n.º 2
0
        protected void listProfiles_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            SharedBasePage page        = Page as SharedBasePage;
            string         profileName = listProfiles.SelectedValue;

            if (profileName != null && profileName != string.Empty)
            {
                page.Redirect(string.Format("~/Profile.aspx?user={0}", profileName));
            }
        }
Exemplo n.º 3
0
        void HandleCommands(object sender, CommandEventArgs e)
        {
            SharedBasePage page = Page as SharedBasePage;

            if ((string)e.CommandArgument == "")
            {
                page.UserTheme = "";
            }
            else
            {
                page.UserTheme = (string)e.CommandArgument;
            }
            page.Redirect(page.Request.RawUrl);
        }
Exemplo n.º 4
0
        protected void listThemes_SelectedIndexChanged(object sender, EventArgs e)
        {
            SharedBasePage page  = Page as SharedBasePage;
            string         theme = listThemes.SelectedValue;

            if (theme == "")
            {
                page.UserTheme = "";
            }
            else
            {
                page.UserTheme = theme;
            }
            page.Redirect(page.Request.RawUrl);
        }
Exemplo n.º 5
0
        protected void buttonSave_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                // There were validation errors, save client states.
                CleanGravatar();
                CleanAutoExpire();
                CleanHtmlComments();
                CleanGeoRss();
                return;
            }

            SharedBasePage requestPage = Page as SharedBasePage;
            SiteConfig     siteConfig  = requestPage.SiteConfig;

            siteConfig.Contact             = textContact.Text;
            siteConfig.Copyright           = textCopyright.Text;
            siteConfig.FrontPageCategory   = textFrontPageCategory.Text;
            siteConfig.FrontPageDayCount   = int.Parse(textFrontPageDayCount.Text);
            siteConfig.FrontPageEntryCount = int.Parse(textFrontPageEntryCount.Text);
            siteConfig.EntriesPerPage      = int.Parse(textEntriesPerPage.Text);
            try
            {
                siteConfig.ContentLookaheadDays = int.Parse(textContentLookaheadDays.Text);
            }
            catch (FormatException)
            {
                siteConfig.ContentLookaheadDays = 0;
            }
            siteConfig.RssDayCount               = int.Parse(textMainMaxDaysInRss.Text);
            siteConfig.RssMainEntryCount         = int.Parse(textMainMaxEntriesInRss.Text);
            siteConfig.RssEntryCount             = int.Parse(textOtherMaxEntriesInRss.Text);
            siteConfig.AlwaysIncludeContentInRSS = checkAlwaysIncludeContentInRSS.Checked;
            siteConfig.EnableRssItemFooters      = checkEnableRSSItemFooter.Checked;
            siteConfig.RssItemFooter             = textRSSItemFooter.Text;
            siteConfig.RSSEndPointRewrite        = txtRSSEndPointRewrite.Text;
            siteConfig.EnablePop3        = checkPop3Enabled.Checked;
            siteConfig.Pop3Interval      = int.Parse(textPop3Interval.Text);
            siteConfig.Pop3Server        = textPop3Server.Text;
            siteConfig.Pop3SubjectPrefix = textPop3SubjectPrefix.Text;
            siteConfig.Pop3Username      = textPop3Username.Text;
            if (textPop3Password.Text.Length > 0 &&
                textPop3Password.Text != passwordPlaceHolder)
            {
                siteConfig.Pop3Password = textPop3Password.Text;
            }
            siteConfig.Pop3DeleteAllMessages = mailDeletionAll.Checked;
            siteConfig.Pop3LogIgnoredEmails  = logIgnoredEmails.Checked;
            siteConfig.EnableXSSUpstream     = checkXssEnabled.Checked;
            siteConfig.XSSUpstreamEndpoint   = textXssEndpoint.Text;
            siteConfig.XSSUpstreamInterval   = int.Parse(textXssInterval.Text);
            if (textXssPassword.Text.Length > 0 &&
                textXssPassword.Text != passwordPlaceHolder)
            {
                siteConfig.XSSUpstreamPassword = textXssPassword.Text;
            }
            siteConfig.XSSUpstreamUsername = textXssUsername.Text;
            siteConfig.XSSRSSFilename      = textXssRssFilename.Text;

            siteConfig.Root                                   = textRoot.Text;
            siteConfig.SmtpServer                             = textSmtpServer.Text;
            siteConfig.SmtpPort                               = int.Parse(textSmtpPort.Text);
            siteConfig.UseSSLForSMTP                          = checkUseSSLForSMTP.Checked;
            siteConfig.NotificationEMailAddress               = textNotificationEmailAddress.Text;
            siteConfig.SendCommentsByEmail                    = checkComments.Checked;
            siteConfig.EnableCoComment                        = checkEnableCoComment.Checked;
            siteConfig.SendPingbacksByEmail                   = checkPingbacks.Checked;
            siteConfig.SendReferralsByEmail                   = checkReferrals.Checked;
            siteConfig.SendTrackbacksByEmail                  = checkTrackbacks.Checked;
            siteConfig.SendPostsByEmail                       = checkPosts.Checked;
            siteConfig.EnableAutoPingback                     = checkEnableAutoPingback.Checked;
            siteConfig.EnableBloggerApi                       = checkEnableBloggerApi.Checked;
            siteConfig.EnableComments                         = checkEnableComments.Checked;
            siteConfig.EnableCommentApi                       = checkEnableCommentApi.Checked;
            siteConfig.ShowCommentsWhenViewingEntry           = checkShowCommentsWhenViewingEntry.Checked;
            siteConfig.EnableConfigEditService                = checkEnableConfigEditService.Checked;
            siteConfig.EnableEditService                      = checkEnableEditService.Checked;
            siteConfig.EnableAutoSave                         = checkEnableAutoSave.Checked;
            siteConfig.EnableTrackbackService                 = checkEnableTrackbackService.Checked;
            siteConfig.EnablePingbackService                  = checkEnablePingbackService.Checked;
            siteConfig.EnableClickThrough                     = checkEnableClickThrough.Checked;
            siteConfig.EnableAggregatorBugging                = checkEnableAggregatorBugging.Checked;
            siteConfig.Subtitle                               = textSubtitle.Text;
            siteConfig.Title                                  = textTitle.Text;
            siteConfig.ShowCommentCount                       = checkShowCommentCounters.Checked;
            siteConfig.Pop3InlineAttachedPictures             = checkPop3InlineAttachedPictures.Checked;
            siteConfig.Pop3InlinedAttachedPicturesThumbHeight = int.Parse(textPop3AttachedPicturesPictureThumbnailHeight.Text);
            siteConfig.ShowItemDescriptionInAggregatedViews   = checkShowItemDescriptionInAggregatedViews.Checked;
            siteConfig.EnableStartPageCaching                 = checkEnableStartPageCaching.Checked;
            siteConfig.EnableBlogrollDescription              = checkEnableBlogrollDescription.Checked;
            siteConfig.EnableUrlRewriting                     = checkEnableUrlRewriting.Checked;
            siteConfig.DisplayTimeZoneIndex                   = Convert.ToInt32(listTimeZones.SelectedValue);
            siteConfig.AdjustDisplayTimeZone                  = !checkUseUTC.Checked;
            siteConfig.EntryTitleAsLink                       = checkEntryTitleAsLink.Checked;
            siteConfig.EnableCrossposts                       = checkEnableCrosspost.Checked;
            if (textPassword.Text.Length > 0 &&
                textPassword.Text != passwordPlaceHolder)
            {
                SiteSecurity.SetPassword(requestPage.User.Identity.Name, textPassword.Text);
            }
            siteConfig.CategoryAllEntries = checkCategoryAllEntries.Checked;
            requestPage.UserTheme         = siteConfig.Theme = listThemes.SelectedValue;

            siteConfig.ReferralUrlBlackList       = textReferralBlacklist.Text.TrimEnd(';');
            siteConfig.EnableReferralUrlBlackList = checkReferralUrlBlacklist.Checked;
            siteConfig.EnableCaptcha = checkCaptchaEnabled.Checked;
            siteConfig.EnableReferralUrlBlackList404s = checkReferralBlacklist404s.Checked;
            siteConfig.ChannelImageUrl            = textRSSChannelImage.Text;
            siteConfig.EnableTitlePermaLink       = checkEnableTitlePermaLink.Checked;
            siteConfig.EnableTitlePermaLinkUnique = checkEnableTitlePermaLinkUnique.Checked;
            siteConfig.EnableTitlePermaLinkSpaces = checkEnableTitlePermaLinkSpaces.Checked;
            siteConfig.EncryptLoginPassword       = checkEnableEncryptLoginPassword.Checked;
            siteConfig.EnableSmtpAuthentication   = checkEnableSmtpAuthentication.Checked;
            siteConfig.SmtpUserName = textSmtpUsername.Text;
            if (textSmtpPassword.Text.Length > 0 &&
                textSmtpPassword.Text != passwordPlaceHolder)
            {
                siteConfig.SmtpPassword = textSmtpPassword.Text;
            }
            siteConfig.RssLanguage           = textRssLanguage.Text;
            siteConfig.EnableSearchHighlight = checkEnableSearchHighlight.Checked;
            siteConfig.EnableEntryReferrals  = checkEnableEntryReferral.Checked;

            siteConfig.FeedBurnerName = textFeedBurnerName.Text.Trim();
            siteConfig.UseFeedSchemeForSyndication = checkUseFeedScheme.Checked;
            siteConfig.LogBlockedReferrals         = checkLogBlockedReferrals.Checked;
            siteConfig.EnableSpamBlockingService   = checkSpamBlockingEnabled.Checked;
            siteConfig.SpamBlockingServiceApiKey   = textSpamBlockingApiKey.Text;
            siteConfig.EnableSpamModeration        = (optionSpamHandling.SelectedValue != SPAM_OPTION_DELETE);
            siteConfig.EnableCommentDays           = checkEnableCommentDays.Checked;
            siteConfig.HtmlTidyContent             = checkAttemptToHtmlTidyContent.Checked;
            siteConfig.ResolveCommenterIP          = checkResolveCommenterIP.Checked;

            siteConfig.TitlePermalinkSpaceReplacement = dropDownTitlePermalinkReplacementCharacter.SelectedValue;

            if (checkEnableCommentDays.Checked)
            {
                try
                {
                    int days = Convert.ToInt32(textDaysCommentsAllowed.Text);
                    if (days > 0)
                    {
                        siteConfig.DaysCommentsAllowed = days;
                    }
                }
                catch (FormatException)
                {
                    siteConfig.DaysCommentsAllowed = 60;
                }
            }
            else
            {
                siteConfig.DaysCommentsAllowed = 60;
            }

            // comments approval
            siteConfig.CommentsRequireApproval = checkCommentsRequireApproval.Checked;

            // removed the ability to edit the html tags, which are allowed for now
            foreach (ListItem li in checkBoxListAllowedTags.Items)
            {
                ValidTag tag = siteConfig.AllowedTags[li.Value];
                if (tag != null)
                {
                    tag.IsAllowed = li.Selected;
                }
            }

            // comments allow html
            siteConfig.CommentsAllowHtml = checkAllowHtml.Checked;

            // comments allow Gravatar and alt path
            GravatarPopulateConfig();

            // supress email address display
            siteConfig.SupressEmailAddressDisplay = checkDisableEmailDisplay.Checked;

            // enable daily report email
            siteConfig.EnableDailyReportEmail = checkDailyReport.Checked;

            PingServiceCollection savePingServices = new PingServiceCollection();

            foreach (PingService pingService in PingServiceCollection)
            {
                if (checkBoxListPingServices.Items.FindByValue(pingService.Endpoint).Selected)
                {
                    savePingServices.Add(pingService);
                }
            }

            siteConfig.PingServices     = savePingServices;
            siteConfig.EntryEditControl = drpEntryEditControl.SelectedValue;

            // GeoRSS stuff.
            siteConfig.EnableGeoRss = checkEnableGeoRss.Checked;
            if (checkEnableGeoRss.Checked)
            {
                siteConfig.EnableDefaultLatLongForNonGeoCodedPosts = checkEnableDefaultLatLongForNonGeoCodedPosts.Checked;
                if (checkEnableDefaultLatLongForNonGeoCodedPosts.Checked)
                {
                    double latitude;
                    if (double.TryParse(textDefaultLatitude.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out latitude))
                    {
                        siteConfig.DefaultLatitude = latitude;
                    }

                    double longitude;
                    if (double.TryParse(textDefaultLongitude.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out longitude))
                    {
                        siteConfig.DefaultLongitude = longitude;
                    }
                }

                siteConfig.EnableGoogleMaps = checkEnableGoogleMaps.Checked;
                if (checkEnableGoogleMaps.Checked)
                {
                    siteConfig.GoogleMapsApiKey = textGoogleMapsApi.Text;
                }
            }

            // open id stuff
            siteConfig.AllowOpenIdAdmin        = chkAllowOpenIdAdmin.Checked;
            siteConfig.AllowOpenIdComments     = chkAllowOpenIdCommenter.Checked;
            siteConfig.BypassSpamOpenIdComment = chkBypassSpamOpenIdCommenter.Checked;

            siteConfig.AMPPagesEnabled = checkAmpEnabled.Checked;

            SiteConfig.Save(siteConfig);

            SeoMetaTags smt = new SeoMetaTags().GetMetaTags();

            smt.MetaDescription = txtMetaDescription.Text;
            smt.MetaKeywords    = txtMetaKeywords.Text;
            smt.TwitterCard     = txtTwitterCard.Text;
            smt.TwitterSite     = txtTwitterSite.Text;
            smt.TwitterCreator  = txtTwitterCreator.Text;
            smt.TwitterImage    = txtTwitterImage.Text;
            smt.FaceBookAdmins  = txtFaceBookAdmins.Text;
            smt.FaceBookAppID   = txtFaceBookAppID.Text;

            SeoMetaTags.Save(smt);

            if (siteConfig.EnableReferralUrlBlackList && siteConfig.ReferralUrlBlackList.Length != 0)
            {
                ReferralBlackListFactory.AddBlacklist(new ReferralUrlBlacklist(), siteConfig.ReferralUrlBlackList);
            }
            else
            {
                ReferralBlackListFactory.RemoveBlacklist(typeof(ReferralUrlBlacklist));
            }

            requestPage.Redirect(Page.Request.Url.AbsoluteUri);
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            SharedBasePage requestPage = Page as SharedBasePage;

            // only allow users to login using openid when we actually allow it
            if (requestPage.SiteConfig.AllowOpenIdComments == true)
            {
                OpenIdRelyingParty      openid   = new OpenIdRelyingParty();
                IAuthenticationResponse response = openid.GetResponse();
                if (response != null)
                {
                    // Stage 3: OpenID Provider sending assertion response
                    switch (response.Status)
                    {
                    case AuthenticationStatus.Authenticated:
                        ClaimsResponse sregResponse = response.GetExtension <ClaimsResponse>();
                        FetchResponse  axResponse   = response.GetExtension <FetchResponse>();
                        string         nick         = response.FriendlyIdentifierForDisplay;
                        string         homepage     = response.ClaimedIdentifier;
                        string         email        = "*****@*****.**";
                        if (sregResponse != null)
                        {
                            nick  = string.IsNullOrEmpty(sregResponse.Nickname) ? sregResponse.FullName : sregResponse.Nickname;
                            email = sregResponse.Email;
                        }

                        if (String.IsNullOrEmpty(nick) && axResponse != null && axResponse.Attributes.Contains(WellKnownAttributes.Name.First) && axResponse.Attributes.Contains(WellKnownAttributes.Name.Last))
                        {
                            nick = axResponse.GetAttributeValue(WellKnownAttributes.Name.First) + " " +
                                   axResponse.GetAttributeValue(WellKnownAttributes.Name.Last);
                        }

                        string comment = Session["pendingComment"] as string;
                        string entryId = Session["pendingEntryId"] as string;
                        if (String.IsNullOrEmpty(comment) == false && String.IsNullOrEmpty(entryId) == false)
                        {
                            AddNewComment(nick, email, homepage, comment, entryId, /* openid */ true);
                        }

                        break;
                    }
                }
            }

            // if you are commenting on your own blog, no need for Captha
            if (SiteSecurity.IsValidContributor())
            {
                CaptchaControl1.Enabled = CaptchaControl1.Visible = false;
            }
            else
            {
                CaptchaControl1.Enabled = CaptchaControl1.Visible = requestPage.SiteConfig.EnableCaptcha;
            }

            resmgr = ApplicationResourceTable.Get();

            if (!IsPostBack)
            {
                if (requestPage.WeblogEntryId.Length == 0)
                {
                    requestPage.Redirect(SiteUtilities.GetStartPageUrl(requestPage.SiteConfig));
                }
                ViewState["entryId"] = requestPage.WeblogEntryId;

                if (Request.Cookies["name"] != null)
                {
                    string nameStr = HttpUtility.UrlDecode(Request.Cookies["name"].Value, Encoding.UTF8);
                    //truncate at 32 chars to avoid abuse...
                    name.Text = nameStr.Substring(0, Math.Min(32, nameStr.Length));
                }

                if (Request.Cookies["email"] != null)
                {
                    email.Text = HttpUtility.UrlDecode(Request.Cookies["email"].Value, Encoding.UTF8);
                }

                if (Request.Cookies["homepage"] != null)
                {
                    homepage.Text = HttpUtility.UrlDecode(Request.Cookies["homepage"].Value, Encoding.UTF8);
                }

                if (Request.Cookies["openid"] != null)
                {
                    openid_identifier.Text = HttpUtility.UrlDecode(Request.Cookies["openid"].Value, Encoding.UTF8);
                }
            }

            DataBind();
        }
Exemplo n.º 7
0
        protected void save_Click(object sender, EventArgs e)
        {
            SharedBasePage requestPage = this.Page as SharedBasePage;

            if (SiteSecurity.IsValidContributor())
            {
                //Catch empty posts!
                if (!editControl.HasText())
                {
                    return;
                }

                CrosspostInfoCollection crosspostList = new CrosspostInfoCollection();
                Entry entry;

                if (CurrentEntry == null)
                {
                    entry = new Entry();
                    entry.Initialize();
                }
                else
                {
                    entry = CurrentEntry;
                }

                //Try a culture specific parse...
                // TODO: Come up with a shiny javascript datetime picker

                if (textDate.SelectedDateFormatted.Length > 0)
                {
                    try
                    {
                        DateTime createdLocalTime = new DateTime(textDate.SelectedDate.Year,
                                                                 textDate.SelectedDate.Month,
                                                                 textDate.SelectedDate.Day,
                                                                 entry.CreatedLocalTime.Hour,
                                                                 entry.CreatedLocalTime.Minute,
                                                                 entry.CreatedLocalTime.Second,
                                                                 entry.CreatedLocalTime.Millisecond);

                        entry.CreatedLocalTime = createdLocalTime;
                    }
                    catch (FormatException fex)
                    {
                        Trace.Write("Bad DateTime string creating new Entry: " + fex.ToString());
                    }
                }

                // see if we need to delete any old Enclosures
                if (entry.Enclosure != null)
                {
                    if (this.enclosureUpload.Visible == true && this.buttonRemove.Visible == false)
                    {
                        DeleteEnclosures();
                    }
                }

                // upload the attachment
                if (enclosureUpload.Value != null && enclosureUpload.Value != String.Empty)
                {
                    try
                    {
                        long   numBytes;
                        string type;

                        string baseFileName;
                        string fileUrl = HandleUpload(enclosureUpload, entry.EntryId, out type, out numBytes, out baseFileName);

                        entry.Attachments.Add(new Attachment(baseFileName, type, numBytes, AttachmentType.Enclosure));
                    }
                    catch (Exception exc)
                    {
                        ErrorTrace.Trace(TraceLevel.Error, exc);
                    }
                }

                entry.Language      = listLanguages.SelectedValue == "" ? null : listLanguages.SelectedValue;
                entry.Title         = entryTitle.Text;
                entry.Description   = entryAbstract.Text;
                entry.Author        = requestPage.User.Identity.Name;
                entry.AllowComments = checkBoxAllowComments.Checked;
                entry.IsPublic      = checkBoxPublish.Checked;
                entry.Syndicated    = checkBoxSyndicated.Checked;

                // GeoRSS.
                if (siteConfig.EnableGeoRss)
                {
                    double latitude, longitude;
                    if (double.TryParse(txtLat.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out latitude))
                    {
                        entry.Latitude = latitude;
                    }
                    else
                    {
                        entry.Latitude = null;
                    }

                    if (double.TryParse(txtLong.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out longitude))
                    {
                        entry.Longitude = longitude;
                    }
                    else
                    {
                        entry.Longitude = null;
                    }
                }

                if (isDHTMLEdit)
                {
                    entry.Content = editControl.Text;
                }

                // handle categories
                string categories = "";

                StringBuilder sb       = new StringBuilder();
                bool          needSemi = false;

                foreach (ListItem listItem in categoryList.Items)
                {
                    if (listItem.Selected)
                    {
                        if (needSemi)
                        {
                            sb.Append(";");
                        }
                        sb.Append(listItem.Text);
                        needSemi = true;
                    }
                }

                categories       = sb.ToString();
                entry.Categories = categories;

                // handle crosspostSiteInfo
                CrosspostInfoCollection crosspostSiteInfo = new CrosspostInfoCollection();

                // we need to reload the crosspostinfo as it contains sensitive data like password
                foreach (CrosspostSite site in requestPage.SiteConfig.CrosspostSites)
                {
                    CrosspostInfo ci = new CrosspostInfo(site);
                    ci.TrackingUrlBase = SiteUtilities.GetCrosspostTrackingUrlBase(requestPage.SiteConfig);
                    crosspostSiteInfo.Add(ci);
                }

                // merge the crosspost config with the crosspost data
                foreach (CrosspostInfo cpi in crosspostSiteInfo)
                {
                    foreach (Crosspost cp in entry.Crossposts)
                    {
                        if (cp.ProfileName == cpi.Site.ProfileName)
                        {
                            cpi.IsAlreadyPosted = true;
                            cpi.TargetEntryId   = cp.TargetEntryId;
                            cpi.Categories      = cp.Categories;
                            break;
                        }
                    }
                }

                foreach (DataGridItem item in gridCrossposts.Items)
                {
                    CheckBox checkSite = item.FindControl("checkSite") as CheckBox;
                    if (checkSite.Checked)
                    {
                        TextBox textSiteCategory = item.FindControl("textSiteCategory") as TextBox;
                        foreach (CrosspostInfo cpi in crosspostSiteInfo)
                        {
                            if (cpi.Site.ProfileName == checkSite.Text)
                            {
                                cpi.Categories = textSiteCategory.Text;
                                crosspostList.Add(cpi);
                                break;
                            }
                        }
                    }
                }

                try
                {
                    // prevent SaveEntry from happenning twice
                    if (crosspostList.Count == 0)
                    {
                        crosspostList = null;
                    }

                    if (CurrentEntry == null) // new entry
                    {
                        SiteUtilities.SaveEntry(entry, this.textTrackback.Text, crosspostList, requestPage.SiteConfig, requestPage.LoggingService, requestPage.DataService);
                    }
                    else // existing entry
                    {
                        SiteUtilities.UpdateEntry(entry, this.textTrackback.Text, crosspostList, requestPage.SiteConfig, requestPage.LoggingService, requestPage.DataService);
                    }
                }
                catch (Exception ex)
                {
                    //SDH: Changed to ex.ToString as the InnerException is often null, which causes another error in this catch!
                    StackTrace st = new StackTrace();
                    requestPage.LoggingService.AddEvent(
                        new EventDataItem(EventCodes.Error, ex.ToString() + Environment.NewLine + st.ToString(), SiteUtilities.GetPermaLinkUrl(entry)));

                    // if we created a new entry, and there was an error, delete the enclosure folder
                    DeleteEnclosures();

                    requestPage.Redirect("FormatPage.aspx?path=SiteConfig/pageerror.format.html");
                }


                entryTitle.Text    = "";
                entryAbstract.Text = "";
                categoryList.Items.Clear();

                if (Session["newtelligence.DasBlog.Web.EditEntryBox.OriginalReferrer"] != null)
                {
                    Uri originalReferrer = Session["newtelligence.DasBlog.Web.EditEntryBox.OriginalReferrer"] as Uri;
                    Session.Remove("newtelligence.DasBlog.Web.EditEntryBox.OriginalReferrer");
                    Redirect(originalReferrer.AbsoluteUri);
                }
                else
                {
                    Redirect(SiteUtilities.GetAdminPageUrl(requestPage.SiteConfig));
                }
            }
        }