c# - Dynamically update the web config for webservice -
i have few web services have configured in web application. in have set webservices dynamic. can see webservices in web.config
file.
for example:
<applicationsettings> <webinterface.properties.settings> <setting name="webinterface_customercard_customercard_service" serializeas="string"> <value>http://localhost:7047/dynamicsnav/ws/supratechnic%20(m)%20sdn%20bhd/page/customercard</value> </setting> </webinterface.properties.settings> </applicationsettings>
in login page need change these webservices dynamically @ runtime , save in web.config
@ time of login. how can change in code behind?
web.config not right place change because shared among users. application can used several users @ same time change affect many of them instead of one. in secure environment, application not able write web.config anyway , - @panagiotiskanavos points out - writing recycle app pool right away.
a better way achieve provide url when instantiate web service client constructor argument. you'd add second url web.config, maybe in appsettings section. in login page, decide url right 1 user , save in place specific user e.g. in session state. whenever create instance of client, retrieve url , provide constructor.
Comments
Post a Comment