Click here to Skip to main content
13,593,573 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
Progrom doing upload excle file from application to sharepoint server. when i am running application on remote server visual studio 2010. its throw error -:

Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Code given below -:

string url = "http://ABRLMOREMOSS/";

           using (SPSite siteCollection = new SPSite(url))
               using (SPWeb spWeb = siteCollection.OpenWeb())
                   SPList spList = spWeb.GetList(url);

                   string fileName = "XXXX";
                   FileStream fileStream = null;
                   Byte[] fileContent = null;

                       string docPath =Server.MapPath("~/Excel/") + "Report2_Suppliers_OU_Invoice_DATE_HM_15_Dec_2012_1.xlsx"; //physical location of the file
                       fileStream = File.OpenRead(docPath);
                       fileContent = new byte[Convert.ToInt32(fileStream.Length)];
                       fileStream.Read(fileContent, 0, Convert.ToInt32(fileStream.Length));
                       spList.RootFolder.Files.Add(spList.RootFolder.Url + "/" + fileName, fileContent, true);
                   catch (Exception ex)

                       if (fileStream != null)
Posted 17-Dec-12 0:49am
Updated 17-Dec-12 2:24am
AnandSharmaUK 21-Feb-13 7:35am
Are you running the code on the same server i.e., http://ABRLMOREMOSS ? Or you are trying to run the code from a different server pointing to http://ABRLMOREMOSS ? I think if you do the later, you can get this error, so can you confirm this please?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180618.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100