I have been tasked with modifying a custom access denied page (SharePoint 2013) I built a year ago. The page was built in Visual Studio 2015 and contains C# code behind. I was asked to add the Site Title to the page. Simple I added lblTitle=SPContext.Current.Web.Title.ToString()
to my code behind and display it in my aspx page.
Works great except that it only works for people who at least have View permissions to the site. If a user who has no rights to the site they get redirected to the access denied page then they get a 403 error. I have determined that it is the call to the site title that is causing this. I have tried getting the site title with elevated privileges but that did not resolve my issue.
So my question has anyone displayed the site title on the Access Denied page before? If so how did you do this. Can it be done with C# or JavaScript from my existing custom page?
Any suggestions appreciated.