TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anand Kannan
NA
26
1.7k
how to get server name in microfocus and use the web config
Mar 11 2014 11:41 AM
I am trying to get the server name in microfocus asp.net and use the same to invoke the connection string from web config.
This is what we do in asp.net - is there a analogous syntax in Microfocus -
<appSettings>
<add key="devconn" value="Data Source=XX\YY;Initial Catalog=XXXTEST;Persist Security Info=True;User ID=XXXWEB;Password=12345678"/>
</appsettings>
if (HttpContext.Current.Request != null){
strSvrName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToString();
}
switch (strSvrName.ToUpper())
{
case "LOCALHOST":
case "XXXDEV.WEB.XXX.COM":
string strDbConn = ConfigurationManager.AppSettings["devconn"];
break;
case "XXXTST.WEB.XXX.COM":
string strDbConn = ConfigurationManager.AppSettings["testconn"];
break;
case "XXXPRE.WEB.XXX.COM":
string strDbConn = ConfigurationManager.AppSettings["prodconn"];
break;
case "XXX.WEB.XXX.COM":
break;
}
Thanks
Anand
Reply
Answers (
1
)
how to display watch on asp.net pages
Bulk update in mvc