I have a MOSS 2007 Webpart that displays data obtained from an external webservice (not originating from sharepoint).
It's created using VS2009, the webpart project includes a WebReference to my WebService and it uses the following code to make a connection (the url is configured in the WebReference):
//get xml sitemap from webservice
MenuService.MenuService service = new MenuService.MenuService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlNode sitemapRootNode = service.GetSiteMapXML();
I compiled the webpart, deployed it in the BIN folder, everything works fine.
However I cannot change the web service URL... If I want to move the webpart to another environment, I need to recompile the whole thing in order to change the webservice URL
Also, when I compile the webpart projects it creates a webpartname.dll.config file that contains the URL to the webservice... however this config files does nothing. If I change it, or simply delete it from the BIN folder, the webpart still connects to the old URL... URL seems to be hardcoded in the webpart DLL.
Is there a way to configure a webpart so it will look in a config file for its webservice URL?