Input string not in correct format SPSite
i am using WSS 2.0 with sharepoint portal server 2003. i am making web application in vs 2008 which opens sharepoint site created in portal server.
when i am passing site address to SPSite it gives me error. "Input String not in Correct format"
here is my code
string site_Str= "http:开发者_如何学JAVA//<serverName>:<PortNumber>/sites/<TopLevelSite>";
SPSite site=new SPSite(site_Str); // here it gives error
and here is stack trace
" 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)"
How can i resolve this.
thanks in advance
try this:
string site_Str= "http://<serverName>:<PortNumber>";
SPSite site=new SPSite(site_Str);
精彩评论