C# - Application Only Partially Reading External Configuration

May 27, 2010

I have an ASP.NET web app and am attempting to reference an external config (using enterprise application blocks configuration) for some of the configuration but it is not entirely working. I previously had all of the configuration info in the web.config (and it was working), but we are wanting to share some of this configuration information between multiple apps. When I put configurationSource tag in the web.config, and read the configuration through the WebConfigurationManager object, it loads some of the external config info (Logging) but not the connectionStrings and not the custom section I created. So it's reading it (logging is working), but some dots aren't being connected and my connection strings aren't coming through.

Again, it worked when it was all in the web.config. I am running .NET 3.5. Any idea what needs to change to be able to reference an external configuration source and have it all come through?

[Code that accesses web.config]
Configuration webConfig =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
ConnectionStringSettingsCollection connectionStrings =
System.Web.Configuration.WebConfigurationManager.ConnectionStrings;
[web.config]
<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=74025d8738dfe4ce" />
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />

</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
<sources>
<add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=74025d8738dfe4ce"
filePath="C:MSEABMSEAB.config" />
</sources>
</enterpriseLibrary.ConfigurationSource>
...
...
</configuration>
[external MSEAB.config]
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=74025d8738dfe4ce" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=74025d8738dfe4ce" />
<sectionGroup name="customSectionGroup">
<section name="customSection" type="app.CustomSection" allowLocation="true" allowDefinition="Everywhere" />
</sectionGroup>
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
...
</loggingConfiguration>
<connectionStrings>
<clear />
<add name="DB.DEV" connectionString="User ID=user;Password=pwd;Data Source=DV1;" providerName="Oracle.DataAccess.Client"/>
<add name="DB.TEST" connectionString="User ID=user;Password=pwd;Data Source=TS1;" providerName="Oracle.DataAccess.Client"/>
...
</connectionStrings>
<customSectionGroup>
<customSection notificationemail="email@mail.com" dirPath="C:Dir" initialrowlimit="500" maxrowlimit="1500" adminadgroup="_admins">
</customSection>
</customSectionGroup>
</configuration>

View 1 Replies


Similar Messages:

Configuration :: Preparing External SQL Database Fo .NET Web Application?

Sep 30, 2010

It's been so long since I've done this that I don't remember how.

Basically, I am creating a Web Application from scratch. I have dragged the LoginBox to the page and went to "Administer Website". Unfortunatel I see no where where I can choose to have the application talk to an externally-hosted database as opposed to defaulting to the "App_Data" folder. I am hosting an SQL instance named "SQLEPXRESS" on my development machine and have configured a database and user. I wish for the site to use this database and user and have set the connectionstring as follows in the web.config:

<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=RUSSELL-DESKTOPSQLEXPRESS;DATABASE=db;UID=user;PWD=pass" providerName="System.Data.SqlClient"/>

Yet even after adding that I see it showing no where in the "Administer Website" section. Please walk me through getting my application to talk to this database and configuring the necessary tables. I remember there needing to be some sort of exe I needed to run to do this, but my Google and forum searching is failing me.

View 1 Replies

Reading Values Of Username And Password From External Source

Jul 1, 2014

I have the following line in my web.config file

<identity impersonate="true" userName="XXXXXX" password="XXXXXXX"/>

I am looking for a way to read the user name and password parameters from other source file such as text file been saved in other server...

View 4 Replies

Configuration :: Reflection + External Dll?

Mar 12, 2010

i have one interface . for which i need to send the input.input can be differe for person to person .i want to create a custom section in app.config .

<customsection url="">
<value1>
<value2>
</customsection>

for this i can create a libaray and do it ..many different libarray for many people with interface inclued in all ..this is want i need to do ...but the problem for me s i dont know wat library he s going to give me .. client will give me only the dll and i hv find the class name and its corresponding custom sectipon and call the interface method and get the output ..Reflection s the way but i dont know how to do it ...

View 2 Replies

Configuration ::access The Second External Config File From Same Webconfig

May 11, 2010

how can i access 2 external config files from web.config file.

i have done it for one external file like this in webconfig:

<appSettings file="........">

Now how can i access the second external config file from same webconfig.

View 1 Replies

Configuration :: How To Compose Website With External Aspx Page

Mar 18, 2010

I have a simple webApplication. Now I have a second webapplication with few web aspx pages. When I build each project I get aspx files with 1 dll per project.

Now the structure of the first webApplication is like this

inwebapplication1.dll

Default.aspx

Is it possible to load the dll of the second application dynamically and put its dll into the bin directory. The result will be something like this:

inwebapplication1.dll

inwebapplication2.dll

Default.aspx

application2default.aspx

The problem is that when I try to open application2default.aspx the compiler is throwing an error that it cannot find the class for that particular page because the assembly inwebapplication2.dll is not loaded. I tried to load the assembly from the web config like this <add assembly="myassemly, Version=1.0.0.0, PublicKeyToken=null, Culture=neutral"/> and also from the code like this Assembly.LoadFrom( @"D:Projectsinmyassemly.dll" ); OR Assembly.Load( "myassemly, Version=1.0.0.0, PublicKeyToken=null, Culture=neutral" ); but I still have no success. Can u tell me what is the logic here with the assembly load?

View 2 Replies

Configuration :: Reading Data From Another Web / Folder?

Jul 12, 2010

From some reasons I added virtual directory to my site- e.g. the entire site running under one domain and one part from another and different folder. I need to read some data that's stored in the main root of the site in text file... but the .NET frame work (and I think iis itself) doesn't give simple access to another folder that declared as different site.

Are there is a way to read the text file? Let's say my main site is-www.domain.com and the virtual directory is-www.domain.com/newsite, (the folders are different, off course, even in different disks) can I get text data from the main root?

View 5 Replies

Configuration :: App Works Well On Local Intranet, But Having Problema On External Access?

Nov 3, 2010

App works well on local intranet, but having problema on external access?

View 4 Replies

Configuration :: External Mail Not Sending - Exchange Server As Host?

Aug 4, 2010

Using Visual Studio 2010 Web Developer Express (vb.net code) with SqlDataSource to SQL Server 2008.

I am developing an email form to my users to send email to vendors with an attachment. The aspx page is quite simple -- 2 dropdownlists, a fileupload control, and a send email button. They select their store (which populates the "From" address of the email). They select the Vendor (which populates the "To" address of the email). Then they browse for the file attachment and click "send email"

I just can't get outside emails to send. I do not get any error messages in the web page. If I change the email1 and email2 in SQL Server Vendor table to an email address (mine) within the domain I get the emails. However when I change to a test hotmail, yahoo, or gmail accounts the emails never get there. I have absolutely no confidence that my programming is correct so before I go to the IT Manager again I really need to verify I am not missing something on my end. We did make a change on the exchange server to allow anonymous email from my webserver and still didn't work.

Here is my webconfig file:

[Code]....

Here is my code-behind:

[Code]....

Here is my aspx page:

[Code]....

I have been playing around with the programming for 2 days making 1 change at a time then testing to see if external email is sending. I'm going quite crazy at this point ...

I've put in breakpoints and debugged. Below is the output from the latest test. I have concerns about the clientDomain being "SQLSVR" which is my webserver name, our domain is "chuckanddons.com". As well as the line "Domain" that is blank " " under NetworkCredential. Also the line TargetName "SMTPSVC/exchangesvr"

[Code]....

View 2 Replies

Web Forms :: Saving XML File At The External Application?

Apr 7, 2010

I'm trying to figure out how to save my XML file in the outside location.

I have a Main web app that uses an XML file as a datasource for one of it's pages. This XML file is generated manually by accessing a utuility page in the same app. I created a utility app that resides outside of the Main app ( it's on my C:/Inetpub/wwwroot) but it should save an XML file in the directory of the Main applicatoin. My utility works fine if I need to save to C:/Inetpub/wwwroot/XMLFiles) but I when I try to access the file at the Main application something like that:

objXML.Save(Server.MapPath("../../_MainApp/App_Dev/Marketing/Tests.xml"));

It gives me an error: System.Web.HttpException: Cannot use a leading .. to exit above the top directory. If I just type full URL it says that URI cannot be resolved.. How can I access that Tests.xml file to update it?

View 6 Replies

Execute An External Application Such That Each Visitor Gets Isolated?

Jul 21, 2010

Actually I don't know whether my question is related to this thread.

I want to create a web application using ASP.NET MVC 2.

For simplicity, let my scenario be as follows:

A visitor is allowed to submit a text file and get a pdf output from the server.

There is an Adobe-Acrobat-like application, that can convert text to pdf, running on my server.

My question is how to execute the converter such that each visitor submitting files cannot interfere with others?

Should I make an instance of the converter for each visitor?

View 4 Replies

Configuration :: Reading Problem In XLS File In 64 Bit Server?

Sep 9, 2010

Reading XLS file in 64 bit server , following errror "microsoft.jet.oledb.4.0 not registered on local Is any solution for this problem?

View 1 Replies

Configuration :: Put MembershipProvider, ProfileProvider And RoleProvider In One Single External Config File?

Oct 5, 2010

How can I put MembershipProvider, ProfileProvider and RoleProvider in one single external config file?

View 1 Replies

How To Integrate An External Web Control Into A SharePoint Application's Page

Feb 15, 2010

How to integrate an external web ASP.NET control into a SharePoint application's page?

View 2 Replies

Security :: Accessing Reporting Application From External Network?

Dec 7, 2010

We have an issue with an internal application, where accessing it from LAN (private n/w) works fine, while access from external n/w throws up erratic behavior.

The Current System :

an aspx page (asp version 1.0) hosted on the IIS server (6.1). The front end is a vb form that connects to a sql 2000 database.

Users' credentials authorized using NTLM security.

Access from an external n/w - a reverse proxy configured with an ISA server 2006 to authenticate credentials.

Domain Controller - Windows Server 2008 R2 x64

The issue when accessed from external n/w :

everytime an entry from a drop-down is selected from an Ajax enabled control, instead of the fields populating, the page gets refreshed and the content of the box are cleared.

Also, clicking on other items that normally hyperlink to other pages, results in nothing happening.

Upon investigation, we realized that :

Everytime it fails, a string - "&AuthResend" followed by an alpha numeric string is attached, which attempts to authenticate the user's credentials everytime a request is made to the server.

ISA error logs yielded the following error msg :

"12210 Internet Server API ( ISAPI ) has finished handling the request. Contact your system administrator. "

This behavior is inconsistent except when accessed from Google Chrome, where it fails each time.

We have applied all the recommended hot fixes from Microsoft's KB pages.

View 1 Replies

Impersonation + Error Reading Configuration Information From The Registry?

Jul 6, 2010

have registered keys in the registry for impersonation for my application (asp.net 2.0 running in IIS 7.0)

<identity impersonate="true" userName="registry:HKLMSOFTWAREMY_SECURE_APPAPPNAMEASPNET_SETREG,userName" password="registry:HKLMSOFTWAREMY_SECURE_APPAPPNAMEASPNET_SETREG,password" />

View 8 Replies

DataSource Controls :: SSIS Package Not Reading Configuration

Mar 2, 2010

The short story is, I'm developing an SSIS package to select from a remote Oracle database (read: no Windows Authentication) and store into an SQL Server db. I can execute the package just fine in development and after importing, but when I run it as a scheduled job, I get an ora-01017 error (bad un/pw). The details are, I built this package and tested in in BIDS but came across the problem that BIDS really doesn't save the password I'd set for the Oracle connection. After poking around a bit, I found this

[URL] which showed how to create an XML configuration which the package could then read. Fiddled around with that, got it working in BIDS. Connected to Integration Services on the server on which I want to run the package, imported it, right-clicked and did the "Run Package" option as a test, it works great. However, when I connect to the same server's Database Engine to create and schedule a job, I cannot connect to Oracle. For some reason, it seems as if the package is not reading the configuration when run in schedule.

I've tried removing the job and re-working it, thinking maybe it didn't pick up the new version when I re-imported the package. A new job had the same problem. Next, I tried re-naming the .dtsConfig and doing the "Run Package" option as a test. Failed with the same error. A bit surprised, I thought I'd get some kind of file error and we wouldn't get as far as trying to talk to Oracle. Anyway, thinking maybe it's permissions on the configuration, fixed the .dtsConfig name and gave full access to Everyone. That ought to let the Agent see it. Scheduled up the job, still can't talk to Oracle. So it seems as if the scheduled version is ignoring the configuration. Anyone have any idea what I'm missing, that scheduling an SSIS package makes it act differently than running it manually? BTW, the instance under which we're running the package is VS 2005. BIDS 2005 to build the package.

View 3 Replies

Web Forms :: Sending Scheduled EMail From Web Application As External Service?

Dec 27, 2010

As indicated in the Subject, I have a web application (say APP) that should feature an e-Mail Notification Service (ENS). Activation of the Service is controlled by a Button in a dedicated page where some parameters are also included to set running Period (FromTime - ToTime), Interval, Recipients, etc.

When said button is clicked, it should maintain those parameters into database then launch ENS. Since ENS is expected to run for good according to set parameters, it logically should run as an external application/service, independent from APP.

When ENS starts, it needs to consult database to fetch parameters, then schedules its Timer to periodically check database for some transactions that when found, should trigger ENS to dispatch e-Mails to concerned Recipient(s).

CHALLENGES:

1. Launch ENS as an external application on button click from APP.Achieved by using System.Diagnostics.Process class. However, I encountered a problem in verifying if the process is already running before starting it. The root of the problem lies in
ProcessName property. Since ALL web applications must be launched via IE, hence, have
iexplore as their ProcessName, which is also applicable to all processes started through IE, it is very likely to have multiple processes utilising IE. How to check which is which? I couldn't figure out that.

Eventually, I ended up with a workaround: when the Process is started from APP, capture its ID and save it to database, then use this ID with GetProcessById() method for later verification. When the Process is terminated, reset stored ID in database.

2. What sort of application should ENS be: Windows Application or Web Application?

In either way however, ENS will always run invisible in the background being a Process. If this is the case, how about creating it as a Windows Service instead?

I did a lot of reading but still confused. However, the choice is limited now to either Web Application or Windows Service. Which one is more convenient to the task in hand?

3. What Timer to use?

I tried System.Timers.Timer in a test web application but it didn't fire! Then I used ASP AJAX Timer and it worked pretty well (I still need though to try running it from APP to judge its functionality). I came across some recommendations to use System.Threading.Timer but haven't tested that yet. Would it worth the trial?

4. ENS as a Windows Service.

If I create ENS as a Windows Service, would I be able to communicate with database? How would this influence the Timer to use?

View 4 Replies

Iis7 - External References Slow Down Application (VS: Add Reference Dialog)?

Aug 6, 2010

I've noticed as my website gets bigger and bigger, the time my laptop takes to display my page is much longer then say a new projects with minimal references. I think there are two variables at play that affect ASP.NET warm-up time:

The quantity of external references The time it takes for a worker process to new() up each instance per worker process Additional time for the WCF objects as the ServiceHost may be in an external DLL First, are those the correct variables to take into account when considering ASP.NET startup time? Next, it appears that web.config may dispatch other objects for use with certain filetypes (*.svc, *.aspx, Windows Identity Foundation (WIF), etc. ). This too may cause delays in ASP.NET.

Last, my project is created as a "web project" not a "web site". Not sure if this has an impact. Is my theory full of holes, or is there something I can do to make development on a old laptop any better?

View 1 Replies

Web Forms :: How To Build Barcode Reading Into An Application

Sep 30, 2010

Can anyone point me to a resource for how to build barcode reading into an ASP.net app? I need to scan a card and have it enter in the database that a person was present at a program that day.

View 5 Replies

C# - How To Integrate Sharepoint Document Into Web Application And Adding Credentials For External Users

Sep 9, 2010

Being new to integrating sharepoint documents into web applications I am struggling with the following task, so anyI have a page in my web application that needs to display a document from sharepoint.I use the appropiate sharepoint web service to get a list of all the documents in the sharepoint list, I then pick out the one I would like to retrieve and get the path to the document so i would end up with something like:

Company%20Hire/Hire%20Site%20Price%20Lists/0.pdf
Within our network I can do following:
iframePdf.Attributes[
"src"] = ConfigurationManager.AppSettings["SharepointUrl"] + _filePath;

This would display the document in iframe... problem I have is coming from outside the network the sharepoint site can't be accessed (due to firewalls etc). We do have a vpn back to our network on the external server our web application sits on. If i was to use the document url in a browser on the server I am prompted for credentials and then get to view the document.Is there a way for the web application to use the vpn, use credentials i give (e.g through impersonation) to access the document and display it to exernal clients?

View 2 Replies

Launch An External Application From The Browsers (IE, Firefox, Chrome, Safari) In Windows?

Jun 19, 2010

Is it possible to embed an external application inside the browser (IE, Chrome, Safari, Firefox) so it will look like a native web application but actually having access to the USB ports of the client machine? I have heard that I need to make an ActiveX control. I would like to use the .Net framework, but if that is not possible, maybe using Java or C++ will be fine.

I have to make an application that will allow to the users to connect an external device to an USB port, this device will take a backup of the information contained in a SIM card and send it to the user's account online agenda. So the user can restore it later using the same application. This should be a web application or at least look like one.

If the first is not possible. Is there any way to launch an external application from all the browsers, and then pass information to the browser window to allow it to refresh after the backup has been made?

View 1 Replies

Elect One Web Application Instance To Perform A Task Triggered By An External Event?

Mar 4, 2010

I have an ASP.NET application running on multiple IIS6 web servers, with a SQL Server 2005 database back-end.

I need to:

monitor the database for the completion of an external job event, and then have exactly one web application instance submit some information to a web service For (1) it seems like a SqlDependency would be the best approach (or just plain old polling). Each web application instance would register such a dependency when it starts up. (I don't want to configure a 'master' instance because the failure of that instance would mean the task doesn't proceed, even if other instances are available. Thus my design is to ensure that if there is an instance available to do the work, then the work ought to proceed.)

For (2) I have been thinking of having some sort of flag in the database that the web application instances try to update once they receive the SqlDependency notification in (1), along the following line (greatly simplified):

UPDATE StatusTable SET TaskStatus = 1 WHERE TaskStatus = 0

SELECT @@ROWCOUNT

that only one application instance would have been able to update the TaskStatus, and thus only one instance would have a @@ROWCOUNT > 0. This would then be the instance 'elected' to submit the information to the web service.

View 1 Replies

Web Forms :: Reading Server Response In Windows Application

Nov 1, 2010

I've got a scenario to work with. In that I've to develop a windows application. On that application when the user enters some data it should be passed to a web application(Third party) and I need to get the response from that web application or web page. The responses will be just APPROVED or DECLINED. But I've no idea how to do with this. Expecting your valuable reply. I'm developing application in .NET 4.0. Plz reply me ASAP.

View 5 Replies

DataSource Controls :: Reading Excel Files Through Application?

Mar 16, 2010

iam Working on Asp.net Web apliation using c#.net, in system folder (Ex: E://Santhu) i have few Flat files and Excels Files .So My Application should read those files automatically and should store the data into my database..

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved