C# - Output Javascript Selectively Depending On Application Settings?

Feb 24, 2010

I am developing a site which includes several different javascript files and libraries. For optimization purposes I have implemented YUI Compressor for .Net

This will minimize and combine my javascript files into one single file.

Now I have put this up in a MSBuild script that automatically does the compression and minimization and outputs it to a file of my choosing. However, I still wish to keep the original javascript files in my development environment. My question is simply:

Is there a good way to depending on the Debug setting for example choose which javascript to use? This to not have to change the MasterPage by hand each time I release the build.

Allow me to illustrate.

If I am running in Debug="true" I wish my MasterPage to include the following javascripts:

<script type="text/javascript" src="first.js"></script>
<script type="text/javascript" src="second.js"></script>
<script type="text/javascript" src="third.js"></script>
<script type="text/javascript" src="fourth.js"></script>

If I am running in Debug="false" I wish this to be outputted in the MasterPage:

<script type="text/javascript" src="compressedAndMinimized.js"></script>

View 2 Replies


Similar Messages:

C# - Web Application Azure Settings?

Dec 6, 2010

We're currently refactoring our ASP.NET 4.0 Web Application to run on both plain old IIS and Azure. For the Settings (in the Properties namespace), I'd like to implement the State Pattern with an AzureSettingsState and a StandaloneSettingsState, which both provide settings getter methods.Now could anybody help me figuring out how ASP.NET deserializes the non-String values (e.g. TimeSpan or StringCollection), so that I can deserialize them on my own in the context class? All settings seem to be strings there.

public abstract class ConfigStateBase
{
public abstract string GetSettingValue(string setting);
}

View 1 Replies

Keep Loosing Application Settings?

Apr 15, 2010

I'm having a weird problem with one of my .net windows applications. I store a number of settings in the application settings (User Scope) but from time to time the settings just seem to dissapear when it's run on the server.

View 3 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# - Migrating Web Application Settings As Configured Through IIS?

Jul 15, 2010

We have a few settings in our web application that can be user configured. As IIS exposes helpers for configuring "Connection Strings" and "Application Settings" we decided to take use this method of configuration.

Unfortunately this works by editing the Web.config file deployed in the web application. This means that a simple upgrade process of copying over the files from a newer web application release resets all configuration settings to the default.

Possible options:

When upgrading the webapp, backup the Web.config and restore it afterwards. This is not elegant and if the latest webapp defines new default-valued properties in the Web.config then this will break Write some admin-only configuration pages on the site and store the values in the DB. This puts the control back in our hands, but it will take work to write this and obviously has bootstrapping problems with connection strings.

View 1 Replies

Web Forms :: Method For Specifying Application Wide Settings?

Apr 5, 2010

I want a separate config file (not app.config) that stores style for various controls in my web application. For example i want to specify the CSS file that modifies all instances of GridView in the website. what is best practice?

View 2 Replies

How To Read A Settings Value From The Web.config File In Application

Aug 18, 2010

I'm trying to use the following command:

Dim xmlFilePath As String = _
System.Configuration.ConfigurationManager.AppSettings("XmlFilePath")

to retrieve the following setting:

<applicationSettings>
<MySolution.WebProject.My.MySettings>
<setting name="XmlFilePath" serializeAs="String">
<value>C:ASP.NETFolderMessageLog</value>
</setting>
</MySolution.WebProject.My.MySettings>
</applicationSettings>

However, xmlFilePath shows up as Nothing after that line of code is run. What's the correct code to get a setting out of the web.config file in an ASP.NET application?

NOTE: Although you can add keys individually to the <appsettings> tag, I'm trying to figure out how to use it with the "Settings" tab in the project's properties.

View 2 Replies

State Management :: App Settings In Application Cache?

Dec 12, 2010

Is it suitable to store some app settings in Application Cache? I mean settings that might need to be changed frequently...

View 1 Replies

C# - Add Items To Properties.Settings At Runtime In Application?

Mar 11, 2011

I want to add an item at runtime to my global settings on an ASP.Net web application. It seems that the Properties.Settings.Default.Properties object is read-only, or at least it's Attributes are so I was trying to write directly into the web.config file. This works correctly but the stuff I found was just dropping my info into the AppSettings section, when I need it to be in the ApplicationName.Properties.Settings so it is made available through the Default.Properties object.

The code I have basically goes like this:

Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
config.AppSettings.Add(mySettingName, myValue);
config.Save();

Which is fine and dandy, except that - obviously enough - my setting turns up in the <appSettings> section of the file. Is there a way I can use the Configuration object to access the ApplicationSettings/ApplicationName.Properties.Settings part of the configuration file? If so how? If not is there another way to write values into my application settings from code?

View 1 Replies

MVC Application Level Soft Coded Settings?

Oct 7, 2010

I am working on a ASP.NET MVC 2.0 Multi-Presentation web application which would use a common codebase to support different websites. These websites would differ in following aspects:

Each website will have their own headers, footers, images, CSS etc (I guess website specific Master Pages)
Some of the UI elements could be different based on soft-coded settings at website level

What is the best approach to handle these requirements? Should I be storing these website level soft-coded settings in Database or multiple config files? I might have to provide a admin UI to manage these soft-coded settings. How do I access these settings in different layers (MVC, Services, Repositories etc) of my application?

View 1 Replies

C# - Where To Store The Global Settings To Allow The Application To Access Them Frequently

Mar 7, 2011

I have some global settings in my application that is going to be handled by the administrator and I store them in the database.

Settings like: board on/off, max items/page on different UserControls, language, hide/show modules.

What technique should I follow to read the values in the database and display the page or the application according to it .. Of course I could do it the easy way and fetch the required settings for each page in the Page_Load event handler but I think that will be a lot of database connection!

View 1 Replies

Visual Studio :: Settings To Check To See What Bogging Down My Application?

Mar 8, 2010

I just uninstalled VWD 2008 Express and installed VWD 2010 Express (all details below). I'm noticing VERY slow load times, on the order of a couple minutes to like 5-6 minutes to load a page. I really don't think this is working right. Is there some setting that I can check to see what is bogging down my app?

Microsoft Visual Studio 2010
Version 10.0.21006.1 B2Rel
Microsoft .NET Framework
Version 4.0.21006 B2Rel

View 3 Replies

MVC :: Selectively Displaying Content In The Master View?

Jun 29, 2010

In any strongly-typed View, I can test for a value within the Model and display content within the View, or not, as I choose. I'm having fits trying to get this same thing to work within the Master View. Since the Master View doesn't have its own Controller, but rather uses the Controller of whatever View is being rendered at the time, it's not like I can assign an object for the Master View to inherit from as I can with a normal View. Or at least I don't know how. I've also tried setting ViewData within a base Controller class, but that hasn't worked out, and is the subject of another thread.

When any View loads, I want to be able to run a check for the current user's security group (not ASP.NET roles, but a special object for the current project). Based on their security group I'll either show certain menu items or not, and direct them to a default View for their group. I suppose that in the default Controller that rolls when the project starts, I can do a check and redirect to an action based on the security group, but that still doesn't tell me how to render out menu items based on

View 1 Replies

State Management :: Cache Settings On Shared Application Pool?

Sep 17, 2010

I have several web applications on a server using the same application pool. The worker process usually takes a lot of ram but usually only from one application. I can successfully limit the cache usage by setting "PrivateBytesLimit" in web.config file when the application uses it own dedicated application pool.

Does anyone know how this setting will be applied when using shared application pool? Is it per application, per worker process or per application pool? Also if it is not per application which setting from which application will be applied?

View 1 Replies

Installation :: IIS Settings To Handle Multiple Users And Application Pool?

Jun 9, 2010

In our IIS (v 6.0) there is one classic ASP app deployed, which has around 35 concurrent users. Now, a new ASP.NET(3.5) app needs to be deployed on the same server which will have its own 50 concurrent users. In this scenario should we create a Application Pool for this new .net app? What are other recommendations for the IIS settings in future?

View 3 Replies

Web Forms :: Can't Read Application Settings From Global.asax In C# VS 2010 Web Project

Jul 22, 2010

I'm working on a new C# web application in Visual Studio 2010, and am having problems reading a value in Web.Debug.Config from the GLobal.asax.cs file.

In the Application_Start event I've got the following code:

Application.Add("AppID", ConfigurationManager.AppSettings.Get("AppID"));

I also tried:

Application.Add("AppID", ConfigurationManager.AppSettings["AppID"]);

And in the Web.Debug.Config file I have the following:

<applicationSettings>
<add key="AppID" value="123" />
</applicationSettings>

I also tried:

<appSettings>
<add key="AppID" value="123" />
</appSettings>

And I tried having it in a file path, like so:

<appSettings file="C:MyPathappSettings.config"/>

When running in debugger, I've got a break-point in the Application_Start event in Global.asax.cs. It hits the break point, but in all cases the value coming back from ConfigurationManager is coming back null. What am I doing wrong?

View 3 Replies

Web Forms :: Application Error Occurred On Server - Current Custom Settings

Nov 13, 2013

I recently bought domain and hosting from godaddy.com and uploaded my website files based on asp.net on server.

The problem is when i run Default.aspx file in visual studio it runs properly but same set set of files when ran after uploading on server gives error in web.config file.

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details:  To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
WindowsMicrosoft.NetFrameworkv2.xConfig
-->

[Code] ....

View 1 Replies

Forms Data Controls :: Selectively Render HTML From GridView

Jan 20, 2010

I have 3 columns in a GridView. The first is a templatefield with a button in it and then other 2 are just plain data from the database. Currently when I try to render the HTML from the GridView I see all 3 columns, but I only want to see the plain data fields. I have seen the answer as:gvQuotes.Columns[0].Visible = alse;But that doesn't work for me, because I still want to keep the first templatefield column on my page.

View 1 Replies

Forms Data Controls :: Display An Icon In Gridview - Selectively?

Aug 24, 2010

I've created an ExpenseReport application which allows users to attach receipts to Expense Report Lineitems. These are contained in a gridview using a template field:

[Code]....

The trouble I have is that the 'attachment.jpg' icon shows for every lineitem (even one that does not contain an attachment). I would like to be able to selectively display this icon or show a different icon if there is NO attachment.

View 9 Replies

Read C# Method Output From Javascript?

Apr 12, 2010

I have a C# class method that return a xml document not file. How to read C# method output from javascript? I don't wont to use script manager.

View 2 Replies

Javascript - Button Output WebForm_DoPostBackWithOptions?

Dec 13, 2010

I need my page to work when JavaScript has been disabled. But my button is outputting onclick="WebForm_DoPostBackWithOptions...". When I set CauseValidation="false" it disappears but I need validation. In what circumstances is WebForm_DoPostBackWithOptions outputted?

View 1 Replies

MVC :: Change The Output Path Of Application?

Mar 16, 2010

I want to change the output path of a MVC2 application that is using the internal ASP.NET Dev Server within VisualStudio 2008.If I let the path "bin" it works. But if the path is changed, I get a Parser error:

Parser Error Message: Could not load type 'MvcApplication3.MvcApplication'.

View 10 Replies

Difference Between Application/x-javascript And Application/javascript Mime Type?

May 6, 2010

There is any difference between application/x-javascript and application/javascript mime type?

View 3 Replies

Display An Output On An External Website By Including A Javascript?

Jul 1, 2010

I would like to display an output on an external website by including a javascript on that external website.

On my aspx-site i did:

[Code]....

I only get a white page on my external site :(

View 11 Replies

Retrieve The Full Output From A Web Application With MSBuild

Jan 12, 2010

I have a misunderstanding with MSBuild. I want to build a web application (with a traditional .csproj project file) and get the "entire output" of the build in a new, clean output folder - including all the website files that are included in the project with <Content Include="....

The AspNetCompiler utility makes this easy for "web site" style projects - you specify the input folder and the output folder, and they can be entirely different.

So far I've only had success specifying the OutoutPath folder, i.e. moving the bin folder - but this only gives me the binaries and ignores aspx, image files, etc.

View 1 Replies







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