NUnit - Configuration Settings Cannot Be Found

Jan 15, 2010

I've written an NUnit test project against an ASP.Net project. The code being tested cannot find the configuration values (in Web.config) when invoked from my test project. What is the right way to provide these configuration settings so my tests will run?

View 2 Replies


Similar Messages:

Configuration :: How To Read Configuration Settings Of Web.config Using Javascript

Apr 30, 2010

Web.config is the main settings and configuration file for an ASP.NET web application. The file is an XML document that defines configuration information regarding the web application. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings

Example 1:

<!-- This is an example Web.config file -->

[Code]....

In this article, we will see how to read the configuration settings in the web.config using 'JavaScript'.

Step 1: Create a new ASP.NET website. Add a button control to the Default.aspx.

Step 2: Right click the project > Add New Item > Web Configuration File

Add the following sample entry to the appSettings section in the web.config between the <configuration> tag as shown in the example 1:

<add key="var1" value="SomeValue"/>

Step 3: To read these entries using JavaScript, add the following script in the <head> tag of your Default.aspx page as shown below:

<head runat="server">
<title></title>
<script type="text/javascript">
function ReadConfigSettings()
{
var v1 = '<%=ConfigurationManager.AppSettings["var1"].ToString() %>'
alert(v1);
}
</script>
</head>
Step 4: Call this function on a button click and display the values of the configuration settings

<input type="button" value="Get" onclick="ReadConfigSettings();" />
That's it. Run the application and click the button. The value of the key in the appSettings will be displayed in the alert window. I hope you liked this short article.

View 7 Replies

Configuration :: How To Change Connection Settings

Feb 8, 2011

Right now, when I am copying the website to host server, I am changing the connection string in webconfig file and at each location of a sqldatasource or a query .. thats like more than 30 places where I am doing this.

When I am done copying the website, I have to change all the connection strings back to dev server for me to keep working on the dev copy....

View 1 Replies

C# - Email Configuration Settings Not Being Fetched?

Nov 15, 2010

I have application that fetches email configuration settings such as host (SMTP Server name), username (SMTP Username) and Password from App.Config File as shown below

<system.net>
<mailSettings>
<smtp from="name@example.com"><network host="smtp.gmail.com" userName="test123@gmail.com" port="25" password="PassworD"/>
</smtp>
</mailSettings>
</system.net>

Now i wish to configure the settings that i have set in database and NOT from App.Config File. From database the credentials are not available in SMTPClient's properties .FYI, they are saved in database as well as the values are also correct.

View 2 Replies

Use XML To Store Configuration Settings In C#.Net Application?

Mar 11, 2011

My question relates to the performance implications of reading application configuration data from an XML file.I am building an application that lists information from a database and needs to know how to display the lists, depending on the types of data returned.This is difficult to explain, but basically I would like to have an XML config file that lists the types and describes how to display them. This will allow me to change the display methods without re-compiling the application.

My question is really around performance. Given that my application will need to use this data many times during each page load...Should I be reading directly from the XML file and parse it each time I need it?
Or should I cache the XML object and parse it each time I need it?Or should I parse the XML once, generate some sort of object and cache that object?My guess is option 3, but I'm basically fishing for best practice around this.

View 1 Replies

C# - Best Way To Store Configuration Settings Outside Of Web.config?

Jun 6, 2010

I'm starting to consider creating a class library that I want to make generic so others can use it. While planning it out, I came to thinking about the various configuration settings that I would need. Since the idea is to make it open/shared, I wanted to make things as easy on the end user as possible. What's the best way to setup configuration settings without making use of web.config/app.config?

View 3 Replies

Configuration :: Settings For Web.Config File?

Sep 22, 2010

I am designing a web application for Leave Application of our faculties. There is a form in my website which represent the existing paper-back leave application form. Users(faculties) have to fill-up this web form and after validation an email will be send to the email address of our principal/hod. I hope that email address(s) will be provided to our group members. Now I want to know that what will be the required configuration of the web.config file? I found this blog ScottGu's Blog. Here the given configuration is:

[Code]....

But I think this is not acceptable for my project as the smtp from="test@foo.com", userName, password are unknown to me. So what should I do. Am I able to understand my requirement to you?

View 4 Replies

Configuration :: Changing Mail Settings Before Deployment?

Apr 5, 2010

Sending eMail from my site is working fine in my local computer.

Before deploying the site to a hosting server, how should I change web.config mailsettings which is :

[code]....

View 4 Replies

Storing Configuration Settings In Web.config Or Database?

Feb 15, 2010

What it best location to store various configuration settings of a web site modules. Creating class (that inherit ConfigurationSection) that map the settings in web.config file?Or creating some DAL and BLL clases that work with database?

View 5 Replies

Configuration :: How To Modify Project Settings At Run Time

Aug 24, 2010

I have several settings in my project area (stored in web.config). However, the scope is not editable and is permanently set to "Application", which means I can't edit them at run time. I would really like to be able to edit these from the web interface. I know that doing so would restart the application (since the web.config was modified), but I'm okay with that, once the settings are written.

Is there any way to programmatically modify the settings in the <applicationSettings><PROJECT.Properties.Settings> area of the web.config?

View 9 Replies

Configuration :: Add Change Settings Form In Website?

Aug 10, 2010

I wish to keep the site settings like ProductsPerpage, SiteName, MaximumFileUploads etc in web.config file I wish to add a "Change Settings" form in the web site in order to change settings. Is it a standard method to access and edit the system.config file programmatically for changing site settings? Else what should be the good approach I should follow?

View 3 Replies

Configuration :: Site Settings File Vs. Web Config?

Nov 12, 2010

I've been thinking about this for a couple days but still would like some feedback on the best way to go about this:

I have multiple sites (domains) that will be running the same code. However, there are a couple settings I have in the appsettings web.config file which are relative to each site. (ie: defaultSiteTitle, emailFromAddress, etc).

I would like to deploy this application in only one location (folder) and point the domains in IIS to that one directory.

To do this, I believe I cannot use the web.config file to hold these settings...

So, I decided to make a SiteSettings.xml file and load the site settings in there:

<sites>
<oSite domain="abc.com" defaultSiteTitle="This is Site ABC" emailFromAddress="info@abc.com" />
<oSite domain="xyz.com" defaultSiteTitle="This is Site XYZ" emailFromAddress="info@xyz.com" />
</sites>

So when I need to access the site settings I just call a function in my datalayer that reads this xml file and via the httpRequest I pass it it determines which site settings to use.

Okay, that works when I call it from a page where I have the httpRequest...

Howver, now when I'm into some business layer functions say sendEmail and I need to find the emailFromAddress from the SiteSettings.xml file, I don't have the httpRequest. I know I could probably hack something together and pass it someway...

But I'm trying to figure out the best way to do this...

I don't really want to store it into session.

Is it possible to tell IIS what web.config file to look at, if I had multiple web.config files? (I don't think this is possible).

View 2 Replies

Configuration :: Medium Trust Settings For XmlResolver?

Mar 29, 2011

When my web application is running under Medium trust, I get an error when executing the method:

View 2 Replies

How To Retrieve Configuration Settings From The Web.config File Programmatically

Jun 17, 2010

I have this portion of my web.config file;

[Code]....

I need to be able to retrieve the value of "from" in my application. How do I read this value into my code?

View 3 Replies

Configuration :: How To Change The CustomErrors Mode Settings In Memory

Dec 18, 2010

By defauly in my web.config I have set the , in runtime I just want to change the Mode = "Off" in memory. I do not want to save the changes to web.config.

Basically we need to see the description of the runtime error, when required.

View 2 Replies

Configuration :: Managing Local / Remote Web.config Settings?

Apr 6, 2010

I'm just wondering what the best practice is for managing web.config connection strings and SMTP settings when working locally in VS2008 and deploying to a remote server?

View 5 Replies

C# - Configuration Settings Those Cannot Be Overridden In Lower Level Web.config Files?

Feb 16, 2011

This is a general question and is not about any particular issue that I am facing right now.As configuration settings in the child level can override the ones in parent level,errors can occur when you have 2 web.config files one redefining configuration settings that you cannot override such as authentication or session state.Issue happens when you have authentication / session state set on the lower level web.config and also in higher level web.config. Is there any other configuration settings like these ?

View 1 Replies

Configuration - Have Settings In The Web.config (and Access Them Using ConfigurationSection) Or In A Separate XML File?

Sep 20, 2010

I have few settings which I could place in a separate XML file and have them accessed in the Web app. Then I thought (thinking of one additional file to deploy), why not have them in the web.config itself. However, just because I need to have custom nodes, I can not have the settings under . So, I am thinking of creating a custom config handler following this. Would that be better than having a separate XML file? Is It going to be an overkill or performance wise? Is there a better way to go?

View 1 Replies

Configuration :: Include IIS Settings From IIS Manager Breaks Deployment Package Build?

Jul 26, 2010

Im trying to build a deployment package out of VS2010 against a web project and want to include all IIS settings as configured in IIS Manager. However when i enable this i get the following error message

Object of type 'manifest' and path

[code]...

Now this error makes very little sense as the specified application does exist in Default Web Site. I've checked the spelling. I've tried having ISV as a virtual directory and as an Application and tried with and without the ISV folder.

On the Web page i hae the Project URL set to [URL] On the Package/Publish tab IIS web site name is set to "Default Web Site/ISV/Web.Crm.Framework/"

Bing/Google search turn up very little on this and the documentation is not really detailed enough.

View 1 Replies

Configuration :: Slow Initial Page Load Speed And Compile Settings

Dec 8, 2010

Over the last week I've been investigating an issue for one of our clients whereby the initial page load following a deployment of their website takes around 1 minute, resulting in unacceptable downtime for end users. This was happening not only for code deplyments (bin dll's and .config files) but also if there were large numbers of .aspx pages updated. For code deployments it's not an issue, but for aspx updates it is; in this particular scenario, we are making use of a 3rd party content management system (RedDot from OpenText) in which every page of the site is published out as a distinct .aspx page. This means that for this website there's somewhere in the region of 2,400 separate .aspx pages. I realise this isn't an ideal situation but we're working within the constraints of the CMS, and we managed to correlate the instances where the site was unresponsive with App pool restarts, which also corresponded to publications of of .aspx pages.

I found an article by Tess Ferandez [URL] which describes all the reasons why the app pool may restart, and it does seem that if more than 15 .aspx pages are changed then the app pool will recycle and the pages will be re-compiled. Another msdn article [URL] then gave me a few pointers on how to start addressing this problem, and for the moment I've set a flag on the compilation options to prevent batch compilation:

<compilation batch="false">

This means that the initial page load now takes around 6 seconds instead of 1 minute, which is a great improvement. However, I also used the "Compilations Total" performance counter to investigate the number of pages that have been compiled by ASP.NET for my site and was quite surprised that the total number of pages that get compiled peaks at 44, which is odd given that there are 2,400 aspx pages in the site. If the batch flag is set to false, the counter slowly increments by 1 page at a time as you click around on the site; if batch mode is true, the initial compilation takes the number straight to 44 over the course of ~60 seconds. What I'm really struggling to understand is why all 2,400 pages aren't compiled. Does anyone have any inside info on what might be going on as all the documentation I've read seems to indicate that all of the pages should be compiled and this counter should be much higher.

View 1 Replies

WCF / ASMX :: The Current Configuration System Does Not Support User-scoped Settings

Aug 8, 2010

I am trying to connect forex trade server from my asp.net application. I am using MT4 Api for connecting. Its installed successfully and added to .net code library. But when i trying to create object of MetaTrader Class i got exception

The current configuration system does not support user-scoped settings.

There is no compile time error in code. I am getting run time exception.

There are the urls where i got some hope for solution but could not able to implement.

[URL]

View 3 Replies

Visual Studio :: Unit Testing With Vs2008 And Null Configuration Settings Values?

Jun 12, 2010

i created a unit test project with the built-in unit testing from vs 2008. i noticed that when running a unit test and in particular when the class i am testing attempts to set a value from the app.config file using the configurationsettings, the configuration settings object always has 0 keys...and thus my value i am trying to use is always null...is there anything about the unit testing structure that would return null values from the app config when i know the keys are there...the existing program uses those keys for email addresses and such already.

View 1 Replies

Configuration :: The Page Cannot Be Found

Aug 31, 2010

I have a link as template column in my customgrid and it is defined as:

<a
target="_blank"
href="<%=ApplicationPath.VirtualPath%>ShowTemplate/<%#
Eval("Recid") %>"
>View Details</a>

On clicking this link, a document should be opened. It is working fine in my local. While it is built and run on server it is showing:

The page cannot be found. The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.

View 6 Replies

Configuration :: Prerequisite Could Not Be Found For Bootstrapping

Nov 18, 2010

i justed moved our projects from vs2008 to vs2010. we are developing a setup project using wix. when i saw the prerequisites for our bootstrapper some are missing and i placed those missed prerequisites in the folder C:Program FilesMicrosoft SDKsWindowsv7.0ABootstrapperPackages. But still it showing the same message. Those missed prerequisites are office2003 pia redistributable and 2007 pia and also microsoft visualstudio tools for office runtime redistributable.

View 1 Replies

Configuration :: Linq Not Found If TargetFramework Not 4.0?

Nov 15, 2010

I have some apps that are in 2.0 and I have 4.0 installed.WHen I build I get the error that targetFramework is only for 4.0 and to remove it for earlier versions.

<compilation debug="true" targetFramework="4.0" />

If I delete the targetFramework entry I get:Type or namespace Linq does not exist in namespace system.I can't upgrade some of the sites and can't delete link from the usings on all of the pages.What can I do and why is Linq the only using that causes the problem?

View 1 Replies







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