SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Failed getting current site subscription id using context uri: in sharepoint while try to redirect to new page
I have an Excel button designed to download an Excel template. When I click the button, it generates the Excel file and redirects to a new page for the download. While this functionality works seamlessly on my testing server, upon deploying to the production server, an error occurs with the message: 'Failed getting the current site subscription ID using context URI.
string _navURL = SPContext.Current.Site.Url + "/_layouts/15/Provider/ShowExcel.aspx?_fileName=" + _filename;
string _navURL = SPContext.Current.Site.Url + "/_layouts/15/Provider/ShowExcel.aspx?_fileName=" + _filename;
string _script = "<script type='text/javascript'>\n" + "window.open('" + _navURL + "');\n" + "</script>\n";
Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect", _script, false);