Share via

Failed getting current site subscription id using context uri: in sharepoint while try to redirect to new page

Muhsin V 0 Reputation points
2024-01-08T19:57:16.58+00:00

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);
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.