Skip to main content
added 323 characters in body
Source Link
Nk SP
  • 2.9k
  • 6
  • 39
  • 62

To take the currentparent Web URL you have to use this:

var currentSource= HttpContext public override void ItemAdded(SPItemEventProperties properties)
        {
           using (SPSite site = new SPSite(properties.CurrentSiteId))
           {
                using (web = site.RequestOpenWeb(properties.UrlReferrerRelativeWebUrl))
                {
                   var parentURL= web.AbsoluteUriParentWeb.Url.ToString();
                }
           }
        }

To take the current URL you have to use this:

var currentSource= HttpContext.Current.Request.UrlReferrer.AbsoluteUri.ToString()

To take the parent Web URL you have to use this:

   public override void ItemAdded(SPItemEventProperties properties)
        {
           using (SPSite site = new SPSite(properties.SiteId))
           {
                using (web = site.OpenWeb(properties.RelativeWebUrl))
                {
                   var parentURL= web.ParentWeb.Url.ToString();
                }
           }
        }
Source Link
Nk SP
  • 2.9k
  • 6
  • 39
  • 62

To take the current URL you have to use this:

var currentSource= HttpContext.Current.Request.UrlReferrer.AbsoluteUri.ToString()