hello all,
i have a web application that i want users to be able to
change the name of the server and database from a web page.
i have got this to work using this...
code:-
Public Sub SetValue(ByVal key As String, ByVal value
As Object)
Dim ds As New DataSet()
ds.ReadXml(Syst em.Web.HttpRunt ime.AppDomainAp pPath
& "web.config ")
Dim dr() As DataRow = ds.Tables("add" ).Select
(String.Concat( "key='", key, "'"))
dr(0).Item("val ue") = value
ds.WriteXml
(System.Web.Htt pRuntime.AppDom ainAppPath & "web.config ")
ds.Clear()
End Sub
called by this:
code:-
Dim aw As New AppSettinsWrite r()
aw.SetValue("Co nnectionPCSRead ", "data source=" &
txtServer.Text & ";initial catalog=" & lblDatabase.Tex t
& ";persist security info=False;user
id=sa;password= ;packet size=4096")
but i need to display the server and database apon load of
the web page, so the user can see what they are editing!
at the mo it's just empty text boxes.
I need to display the "data source" in the server box,
and to display the "initial catalog" in the database box.
please could you help,
thanks,
Tom. 1 10615
Hi,
it is not recommendable to let users write straight to the web.config file,
because it will also restart the ASP.NET application every time. That means
losing cache every time and so on.
However Jason Gaylord has written couple of articles about the subject so
perhaps you got take a peek on that: http://aspalliance.com/jgaylord/colu...ebconfig1.aspx http://aspalliance.com/jgaylord/colu...ebconfig2.aspx
--
Teemu Keiski
MCP,Designer/Developer
Mansoft tietotekniikka Oy http://www.mansoft.fi
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com
Email: jo****@aspallia nce.com
"tom" <to********@uka utomation.com> kirjoitti viestissä
news:92******** *************** *****@phx.gbl.. . hello all,
i have a web application that i want users to be able to change the name of the server and database from a web page.
i have got this to work using this... code:-
Public Sub SetValue(ByVal key As String, ByVal value As Object) Dim ds As New DataSet() ds.ReadXml(Syst em.Web.HttpRunt ime.AppDomainAp pPath & "web.config ") Dim dr() As DataRow = ds.Tables("add" ).Select (String.Concat( "key='", key, "'")) dr(0).Item("val ue") = value ds.WriteXml (System.Web.Htt pRuntime.AppDom ainAppPath & "web.config ") ds.Clear() End Sub called by this:
code:-
Dim aw As New AppSettinsWrite r() aw.SetValue("Co nnectionPCSRead ", "data source=" & txtServer.Text & ";initial catalog=" & lblDatabase.Tex t & ";persist security info=False;user id=sa;password= ;packet size=4096") but i need to display the server and database apon load of the web page, so the user can see what they are editing!
at the mo it's just empty text boxes.
I need to display the "data source" in the server box, and to display the "initial catalog" in the database box.
please could you help,
thanks,
Tom. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marek |
last post by:
Hi there,
my WinForm application has to be installed in "no-touch-deployment" mode, so
users can run it from the web. I need to read application's .config file but
it does not work in no-touch-deployment.
Could anyone give me directions to documentation piece (or article) that
explains how to implement app .config file reading in...
|
by: Joan Bos |
last post by:
Hi,
Is there somewhere on the Internet a description of what a .NET
application config file should contain?
For our application, I have to write passwords encrypted in a config
file. The Enterprise Library does have an encryption method, but that
method doesn't just return a value - no - it wants to write the value
immediately to a...
|
by: Mustaq |
last post by:
Hi,
How to read same config file from different application?
I have 4 application in VB.NET, all are using different app.config files.
NOW I need all to read only one config file, how can I do this.
Thanks in Adv.
Regards,
|
by: Danny |
last post by:
Hello,
I was wondering if anyone knew if it was possible to make changes to
an application's App.config file at runtime and then be able to access
those changes immediately.
The following is an example of what I'm trying to achieve:
I tried a test by creating a simple app Test.exe that has some basic
settings made available to it in...
|
by: vkrasner |
last post by:
It works with VS2003 and does not in VS2005:
in VS2003 :
string sMyvalue = ConfigurationSettings.AppSettings;
in VS2005 (does not work!!)
string sMyvalue = ConfigurationManager.AppSettings;
Anybody able to give me idea how-to read by C# element which I add to the
machine.config into the new single section?
| |
by: Shaun Ram |
last post by:
Hi, I have this constraint. A help would be greatly appreciated.
I have this Config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configsections>
<sectionGroup name="mainsection">
<section name="ConnectionString"
type="System.NamevaluesectionHandler,System" />
</sectiongroup>
|
by: Carlos AZ |
last post by:
I have the following XML file named (applicattion.exe.config):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<AppSettings>
<add key = "PathBD" value = "c:\project\data\maco.mdb" />
</AppSettings>
</configuration>
|
by: Stephen Costanzo |
last post by:
Looking back in the group, I figured out how to read from the appSettings
section of the configuration file.
I have default values for the application in the unlikely event that the
user deletes the configuration file. My question is this: How do I write the
defaults back out to the configuration file at run time? is this even
possible?
...
|
by: Sridhar |
last post by:
Hi,
I have created a project which contains classes to read the data from the
database. This project has an App.Config file which contains the
SqlConnection String. when this code is called from a web application and if
I need to read the connection string it is reading the connection string from
the web.config of web application. I am not...
|
by: CSharp-Jay |
last post by:
So I have been programming in C# on a personal level as of lately, and
am curious about something. Lately I have been experimenting around
with file create/write, etc. I can open and read the whole file, but
how do I read specific words into my program? Like for example, I
have an ini file that my program writes to and needs to read from to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |