C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







How to create variables in web.config file. how to use that variables in codebehind file. explain cl


Posted Date: 18 Mar 2008      Total Responses: 4

Posted By: samul       Member Level: Gold     Points: 2


How to create variables in web.config file. how to use that variables in codebehind file. explain clearly.



Responses

Author: Syam Kumar    18 Mar 2008Member Level: SilverRating:     Points: 2
Define variables in web.config as below
<appSettings>
<add key="DebugFlag" value="120"/>
</appSettings>

and use this in code behind as below.
ConfigurationSettings.AppSettings["DebugFlag"].ToString()


Author: MuniHemadriBabu.Jogi    18 Mar 2008Member Level: GoldRating:     Points: 2
<appSettings>
<add key="nameofkey" value="valueofkey" />
</appSettings>

in code behind

Configaration.configarationsettings.appsettings.get(nameofkey)


Author: sujit kumar biswal    18 Mar 2008Member Level: GoldRating:     Points: 2
in code behind

<appsettings/>
<connectionstrings>
<add name="conn" connectionstring="server=(local);database=db;ui=sa;pwd=password"/>
<connectionstrings/>

in codebehind

sqlconnection con=new sqlconnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);



Author: krishna    18 Mar 2008Member Level: SilverRating:     Points: 2
Define variables in web.config
<appSettings>
<add key="MyName" value="MyValue"/>
</appSettings>

and use this in code behind as below.
Default.aspx:

ConfigurationSettings.AppSettings["MyName"].ToString()



Post Reply
You must Sign In to post a response.
Next : Return type of function
Previous : Diff between vachar and nvarchat
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

teleconferencing

Contact Us    Privacy Policy    Terms Of Use