use the below single line to show the error message in C# code behind in SharePoint.
ScriptManager.RegisterStartupScript(this, GetType(), “flash”, “alert(‘Error Message’);”, true);
The complete code will look like as this:
SPSite objSite = new SPSite(“http://sharepoint13:1245”); // I am trying to get the object of a site collection out side the FARM
ScriptManager.RegisterStartupScript(this, GetType(), “flash”, “alert(‘ You can not get the object out side this FARM’);”, true);
Note: In the above code block I am trying to get an object of a site collection out side the FARM.
Hope this helps, happy development in SharePoint !!!
-: FREE PDF e-Book Download :-
51 JSOM Examples in SharePoint Online
You May Also like the Following SharePoint Online Tutorials: