In every ASP.Net application we used to access webconfig appsettings key values
for use sql connection and other key values which have to be controlled from out
of page. So to achieve this in ASP.Net we use the following command
This gives the value which has been written in webconfig like, <appSettings file=""> <clear/>
<add key="ConStr" value="Data
Source=DataSourceName;Initial Catalog=DataBaseName;User ID=UserName;Password=Password"/> </appSettings>
But in silverlight application we cant use appsettings as like asp.net
application. Because the silver light application is a client side application.
So in this article we are going to see how to access appsettings in silverlight
application. Code in WebConfig: <appSettings file=""> <clear/>
<add key="SampleVal" value="1"/> </appSettings>
Here specify which value you are going to use in silver light application.In add
tab Key is the name of the key and value is the accessing value of the key. Pass The config value to aspx page:
To pass the config value add param in silverlight application object. <param name="initParams" value=" SampleVal =<%=
System.Configuration.ConfigurationManager.AppSettings["SampleVal "]%>"/> To get the value in xaml page:
To use the key value in MainPage.xaml first get it in app.xaml and pass it to
In App.Xml get the value by below code. public string
SampleVal =""; private void
SampleVal = e.InitParams["SampleVal
"]; this.RootVisual =
To use value in MainPage.xaml
App application = (App)Application.Current;
String finalval= application. SampleVal;
Silverlight Invoke Commands
Silverlight - Slide In Transition Effect
its to change dynamic input..
Post your question in Forums section here is the link "http://www.c-sharpcorner.com/Forums/AddPost.aspx?TSource=AddPost"
Is it safe to pass application setting through parameters?
Can anyone view those parameters in request/Fiddler?