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);
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,574 questions
0 comments No comments
{count} votes

Your answer

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