Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Application page not working for sharepoint 2013

$
0
0

Hi,

Below is the code for event which on item adding redirects to Application page.

                     

 using (SPWeb owebsite = new SPSite(properties.SiteId).OpenWeb(properties.RelativeWebUrl))
            {
                SPListItemCollection collitems = owebsite.Lists[properties.ListTitle].Items;

                if(collitems.Count > 10)
                {
                    properties.Cancel = true;
                    properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
                    string ErrorMessage = "Adding more items are prevented . Count = " + collitems.Count.ToString();
                    properties.RedirectUrl = "http://win-mq3esu10uuj/sites/km/_layouts/15/InductionNew/ExceptionPage.aspx?Error=" + ErrorMessage;
                }
                else
                {
                   base.ItemAdding(properties);
                }
}

The above code was working fine in last sharepoint 2010 project but in sharepoint 2013 

while adding item i only get error "The server was unable to save the form at this time. Please try again." but its not redirected to the ExceptionPage.aspx application page


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>