0

我正在将 WSS 2.0 与 sharepoint 门户服务器 2003 一起使用。我在 vs 2008 中制作 Web 应用程序,它打开在门户服务器中创建的 sharepoint 站点。

当我将站点地址传递给 SPSite 时,它​​给了我错误。“输入字符串格式不正确”

这是我的代码

string site_Str= "http://<serverName>:<PortNumber>/sites/<TopLevelSite>";
SPSite site=new SPSite(site_Str); // here it gives error

这是堆栈跟踪

"   at Microsoft.SharePoint.i.a(Boolean A_0, String A_1, Guid A_2, Int32& A_3)\r\n   at Microsoft.SharePoint.SPSite.j()\r\n   at Microsoft.SharePoint.SPSite.a(String A_0, SPVirtualServer A_1, a A_2, Int32 A_3)\r\n   at Microsoft.SharePoint.SPSite..ctor(String strUrl)\r\n   at testRoundLink._Default.GetJavaScript() in E:\\resarch\\testRoundLink\\testRoundLink\\Default.aspx.cs:line 46\r\n   at testRoundLink._Default.Page_Load(Object sender, EventArgs e) in E:\\resarch\\testRoundLink\\testRoundLink\\Default.aspx.cs:line 19\r\n   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)\r\n   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n   at System.Web.UI.Control.OnLoad(EventArgs e)\r\n   at System.Web.UI.Control.LoadRecursive()\r\n   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"

我该如何解决这个问题。

提前致谢

4

1 回答 1

0

试试这个:

string site_Str= "http://<serverName>:<PortNumber>";
SPSite site=new SPSite(site_Str); 
于 2011-09-14T06:49:26.787 回答