.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Requesting static resources

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hi!I created method IsMobileRequest(HttpContext ctx) that checks whether or not user agen is mobile browser. If it is mobile browser, application will redirect user to /mobile controller.Code in Global.asax for redirection handling:protected void Application_BeginRequest() { if(Helpers.MobileUtilities.IsMobileRequest(Context)) { HttpContextBase currentContext = new HttpContextWrapper(HttpContext.Current); RouteData routeData = RouteTable.Routes.GetRouteData(currentContext); String currentControllerName = currentControllerName = (String) routeData.Values["Controller"]; if (currentControllerName.ToLower() != "mobile") { Context.Response.Redirect("/mobile"); } } } This code succefully redirected all request to /mobile but when front-end developer inserted markup that loads static contents (/Content/Images, /Content/Styles, etc.) mobile page didn't render those static files.After some experimenting, I noticed that in ASP.NET MVC request for static files passes throught application stack (Global.aspx) as well as dynamic requests.This version of code addresses that issue:protected void Application_BeginRequest() { if(Helper

View Complete Post

More Related Resource Links

Static and Dynamic Resources with Brush and Resource Dictionary

Hi, We're using a huge resource dicionary with all the styles and templates for our controls. Some of these are the images that we use for some buttons and icons in the application. As far as I know, Static and Dynamic resources have nothing to do with the ResourceDictionary and The Brush, i could use any of them, if i need the resource to load only when needed i could use dynamic and if i want it to load on initialization time i should use Static. But everytime i try to use a static resource to define a Fill of a rectangle my application crashes on initialization time (when it exectues the InitializeComponents). The resource i'm using is a DrawingBrush that is declared on my resource dictionary and the only way i could make it works is defining it as DynamicResource. What is the limitation? Its realy impossible to define a static resource on a fill property, and if its realy impossible, why?

Does WPF implicit caching of static resources?



in my Application.Current.Resources.MergedDictionaries is a ResourceDictionary with theme specific resources. If the user selects another theme, the theme-depended control is removed from it's parent (Grid) and a splash screen is inserted instead. After replacing the theme-specific ResourceDictonary in the Application.Current.Resources.MergedDictionaries, the theme-depended control is created anew and replaces the splash screen. But, the control still uses the static resources from the replaced ResourceDirectory. Why? Is there any implicit resource caching in WPF? In the Silverlight port of the app, the static theme resources are applied correctly.  


Static Class for Beginners

In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

How to detect and avoid memory and resources leaks in .NET application

Despite what a lot of people believe, it's easy to introduce memory and resources leaks in .NET applications. The Garbage Collector, or GC for close friends, is not a magician who would completely relieve you from taking care of your memory and resources consumption.

I'll explain in this article why memory leaks exist in .NET and how to avoid them. Don't worry, I won't focus here on the inner workings of the garbage collector and other advanced characteristics of memory and resources management in .NET.

SharePoint 2010 - Top 10 Resources to get you started

This post contains links to download evaluation software, guides, demo virtual machines and lots more, for both Developers and IT Professionals.SharePoint 2010 - Top 10 Resources to get you started

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

Resources for soup-to-nuts of website development lifecycle



 I'm looking for a website, or book, or some resource that can lead me down the path from website design to implementation/deployment. I know that covers a ton of material, but I am really looking for the bullet points, or high-lights, to make sure that I think of everything. I am mostly fuzzy on security measures and deployment since I haven't been involved in those aspects before.

Background:  I have been a programmer for many years, and with a little over 3 years' experience coding websites in vb.net/asp.net with sql server. Due to recent restructuring/layoffs at our firm, I find myself in the position of lead IT person - I'm feeling a bit underqualified but I feel this is my chance to work hard and step up to it. I'm very good at vb.net, master pages, css, asp.net, sql server. I'm worried that the person who was the lead before was doing a bunch of stuff that I'm not aware of...so I need to start learning more than just the code. I don't need lessons on how to code anything...I need to learn how it all gets put together - the next step up.

thanks for any suggestions!

NUnit and public static readonly


I have an app that I am testing with NUNit.  The project im testing has several helper classes that are created as public static readonly.  When I run the NUnit tests, they all fail with the same error

SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.

I kept getting this error despite stripping out all

Toolbox: Static Analysis Database Tools, Managing Remote Computers, And More


If you want to apply static analysis to your databases, connect to remote computers, find out more about the Entity Framework, or just check into some cool podcasts for your daily commute, then you'll want to read more about these latest tools and resources.

Scott Mitchell

MSDN Magazine July 2009

Toolbox: Static Analysis Tools For .NET, Matt Berseth's Blog


This month we take a look at FxCop and other tools that enforce your design rules, along with jQuery.

Scott Mitchell

MSDN Magazine December 2008

Basic Instincts: Resources and Localization in ASP.NET 2.0


In this installment of Advanced Basics Ted Pattison discusses the localization of Web sites in ASP.NET 2.0.

Ted Pattison

MSDN Magazine August 2006

Basic Instincts: Resources and Localization


There are two ways you can utilize resources such as strings, images, and text-based files from your Microsoft® . NET Framework-based application. You can embed them directly in the app or you can load them from an external file.

Ted Pattison

MSDN Magazine May 2006

New Stuff: Resources for Your Developer Toolbox


Databeacon Smart Client software allows users to perform data analysis, turning relational data from any data source into online analytical processing (OLAP) cubes that can be explored and manipulated using one of three Databeacon viewers.

Marnie Hutcheson

MSDN Magazine December 2005

New Stuff: Resources for Your Developer Toolbox


Code refactoring is defined as the act of changing code without changing what it does. The actual work involved in refactoring-extracting methods from oversized modules, tidying up and unifying variable names, identifying unhandled exceptions, and all the other cleanup, simplification, and standardization chores-can be daunting, indeed, and risky too.

Marnie Hutcheson

MSDN Magazine November 2005

New Stuff: Resources for Your Developer Toolbox


ActiveReports for . NET 2. 0 by Data Dynamics is written in C# and integrates with the Visual Studio® . NET development environment to let you create dynamic reports and charts. Drop the Report Viewer control on your Windows® Form or Web Form, specify the data source and authentication information for the data connection wizard, and it builds the connection string for you.

Marnie Hutcheson

MSDN Magazine October 2005

New Stuff: Resources for Your Developer Toolbox


From my first look at VG. net V2. 4b by Prodige Software Corporation, it seemed like just another typical graphics add-on, but as I discovered what a potent tool it is for Visual Studio® . NET graphical interface development, I became more and more impressed.

Marnie Hutcheson

MSDN Magazine September 2005

New Stuff: Resources for Your Developer Toolbox


Tired of spending oodles of time trying to reproduce bugs so you can then fix them? RadViewSoftware Inc. has a new addition to their Web application function and load testing tools that captures everything that goes on at the client and the server in synchronized logs.

Marnie Hutcheson

MSDN Magazine August 2005

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend