I am trying to read a SharePoint list in an asp.net application; the following code does not work. It errors out:
The Web application at http://MyServerName:1201 could not be found. 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.
protected void Page_Load(object sender, EventArgs e)
{
{
using (SPSite site = new SPSite("http://MyServerName:1201"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["MyList"];
dropSite.DataSource = list.Items;
dropSite.DataValueField = "Title"; // List field holding value - first column is called Title anyway!
dropSite.DataTex ...
Go to the complete details ...