Obsolete functions

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am getting obsolete function warnings on these two liens but can't figure
the correct syntax for the new equivalent functions;

ConfigurationSettings.AppSettings.Get(key)
Dns.GetHostByName(_strServer)

Would appreciate if someone can give me some hints to get rid of the
obsolete function warnings on these two lines.

Thanks

Regards
 
[...]
ConfigurationSettings.AppSettings.Get(key)
Dns.GetHostByName(_strServer)

Would appreciate if someone can give me some hints to get rid of the
obsolete function warnings on these two lines.

I thought alternatives were documented somewhere, but I don't see them at
the moment.

I suspect that the ConfigurationSettings alternative they expect you to
use is the Settings class, which the VS designer knows about and which you
can get from your project's namespace.

For sure, you can use Dns.GetHostEntry() as an alternative to
GetHostByName().

Pete
 
The <appSettings> section of your web.config file is now superseded by the
<applicationSettings> section, so you are being warned to not use the older
appSettings property.

Sorry, I don't know about the other one.
 
I know the first is:

ConfigurationManager.AppSetting(key)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
Be very careful if you would try to replace GetHostByName with GetHostEntry.
About an year ago I also tried to replace GetHostByName deprecated warning
with GetHostEntry.
The problem is that GetHostEntry doesn't work correctly on some of the OSes.
I think at least XP was affected. There was quit long discussion on MSDN
forums regarding this problem. May be since then this problem has been fixed
with a hotfix or SP, but anyway do pay attention to this issue.

Regards,
Yury
 
Hi there,

For the first query, you need the ConfigurationManager object (found in System.Configuration.dll).
This object replaces the ConfigurationSettings object and contains methods
such as AppSettings() to allow you to retrieve values from config files.

As for the DNS stuff, I'll leave that to someone else as I'm not sure about
that one.

Jas.
 
Back
Top