Anyone know how I set the connection string from within a class library written in c#, at the moment I get a ArgumentNullExption parameter cannot be null: connection string. Can umbraco read this from anywhere besides web.config?
What are you trying to do? Umbraco reads its connectionstring from the web.config. so if you want to change it change it there. Maybe if you give more info why you want to change the connectionstring people can help you.
Hi Richard, many thanks for the reply - here's a bit of background of what im attempting. I have a series of methods in an asmx that basically correspond to different mime types eg. like an audio file (below). . the base methods all work fine from usercontrols i deploy - what i really want is to make a series of webmethods , so i can connect a rich client written in as3
I looked into the source code of umbraco.business and found the area I might need to override but so far trying to setup VS to debug umbraco.business with my solution is challenging - the hope was to encapsulate the umbraco related function in the class lib and just import my class lib into the webservice
Thanks Anthony yea done that.. its not a normal base class exception in c# - the issue i think is main how to supply whats required to umbraco outside of its appdomain. at the moment i just recieve connection string null - but a class library doesnt use a web.config but its own settings file..
Maybe this can be done from the existing webservices in umbraco ? - only caveat I see is I'm uploading a file as a base64 encoded string through the webmethod - anyone have any experience uploading a file through the umbraco api or a better idea than what i've presented ?
C# Class Library question
Anyone know how I set the connection string from within a class library written in c#, at the moment I get a ArgumentNullExption parameter cannot be null: connection string. Can umbraco read this from anywhere besides web.config?
thanks
Mike
Hi Mike,
What are you trying to do? Umbraco reads its connectionstring from the web.config. so if you want to change it change it there. Maybe if you give more info why you want to change the connectionstring people can help you.
Cheers,
Richard
have you added system.Configuration to your class library?
Hi Richard, many thanks for the reply - here's a bit of background of what im attempting. I have a series of methods in an asmx that basically correspond to different mime types eg. like an audio file (below). . the base methods all work fine from usercontrols i deploy - what i really want is to make a series of webmethods , so i can connect a rich client written in as3
my custom webmethod
[WebMethod]
public bool CreateAudioDocument(string caption, string body, string fileData)
{
byte[] content = Convert.FromBase64String(fileData);
Orbitalmedia.CMS.api.documenttypes.Audio.CreateAudioDocument(caption, body, content);
return true;
}
I looked into the source code of umbraco.business and found the area I might need to override but so far trying to setup VS to debug umbraco.business with my solution is challenging - the hope was to encapsulate the umbraco related function in the class lib and just import my class lib into the webservice
from GlobalSettings in umbraco.business
protected static void SaveSetting(string key, string value)
{
ExeConfigurationFileMap webConfig = new ExeConfigurationFileMap();
webConfig.ExeConfigFilename = FullpathToRoot + "web.config";
Configuration config =
ConfigurationManager.OpenMappedExeConfiguration(webConfig, ConfigurationUserLevel.None);
config.AppSettings.Settings[key].Value = value;
config.Save();
ConfigurationManager.RefreshSection("appSettings");
}
any ideas appreciated
cheers !
Mike
Thanks Anthony yea done that.. its not a normal base class exception in c# - the issue i think is main how to supply whats required to umbraco outside of its appdomain. at the moment i just recieve connection string null - but a class library doesnt use a web.config but its own settings file..
cheers
Maybe this can be done from the existing webservices in umbraco ? - only caveat I see is I'm uploading a file as a base64 encoded string through the webmethod - anyone have any experience uploading a file through the umbraco api or a better idea than what i've presented ?
cheers
Mike
is working on a reply...