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

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT
Post New Web Links

Optimize WebResource.axd and ScriptResource.axd in asp.net

Posted By: Amit Mehra     Posted Date: September 16, 2009    Points: 2   Category :ASP.Net
When the handler is requested by the browser it looks for a URL parameter containing the references to the original resource script. They are separated by a comma in the URL parameter. It then retrieves the content of each script using a HTTP request. Then content is then aggregated into a single string which then get's minified. Minifying means that all comments and whitespace is removed from the script.

View Complete Post

More Related Resource Links

How to Combine ScriptResource.axd and WebResource.axd files in ASP.Net 2.0


 Hi All,

Please help me to resolve the below issue

Basically My requirement is  to combine webresource.axd and scriptresource.axd files. 

As you know when we use asp.net ajax and ajaxtoolkit in the application by default , some of the javascript files(webresource.axd and scriptresource.axd) will load automatically. 

For loading all the JavaScript files browser will take multiple requests, To reduce the multiple requests i am trying  to combine all the scripts into one file and loading into the client side. 

I have tried to resolve using custom httpmodule and httphandlers but they are still putting me in loops. 

If i am not using AjaxToolkit Controls my custom httpmodule working fine to combine scriptresource.axd and webresource.axd files

andalso browser taking only one request to get all the javascript files.

if i am using Ajaxtoolkitcontrols i am getting error scriptLoad Failed exception and sys is undefined

I just wanted to knock people to understand if they had used a different method, we could get some help. 

I want to do everything using asp.net 2.0



How to process scriptResource + WebResource in httphandler


I have a httphandler (scripts.ashx) which combines all javascript files into 1 file and feeds the client this 1 file, instead of a 15 differt javascript files. This is working fine, however my scriptmanager (and whatelse) is also creating scriptresources and webresources (I have 9 of those) and also I have a javascript-enabled webservice, which also generated a javascript file.

I would like to include these 10 files in the httphandler I use to create 1 large javascript-file.

Anyone has an idea how I can get these scriptresources/webresources processed in the httphandler, so they don't have to be generated seperately anymore ? (Having 1 file instead of 25)

Thanks in advance,


Imports System.Web
Imports System.IO
Imports System.IO.Compression

Public Class Script : Implements IHttpHandler
    Private cache_duration As TimeSpan = TimeSpan.FromDays(30)
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim encoding As UTF8Encoding = New UTF8Encoding(False)
        Dim ms As New MemoryStream()
        Dim jsFiles As New List(Of String)
        If HttpContext.Current.Request.QueryString("type") = "" Then      

Using a GenericHandler as a WebResource inside a Class Library



I hope this is the right place to ask this question.

I'm trying to make a control class library. I want to have a GenericHandler as a WebResource so I could call it from the web project that will use that control.

I need this handler will get parameters from the query string and return JSON data acourding to what it get in the QS.

I know how to create JS and images WebResources, so I tried the same on a generic handler I added to the class library project but all it does is return the source of the handler file and not the result.


Is what I'm trying to do possible? If so, what should I do?


Thank :-)

SQL Server: Uncover Hidden Data to Optimize Application Performance


SQL Server 2005 gathers a lot of useful data that you can use to identify areas where database performance can be improved. Here's what you need to improve performance.

Ian Stirk

MSDN Magazine January 2008

Parallel Performance: Optimize Managed Code For Multi-Core Machines


While multi-core processors have become increasingly common, most applications still fail to take advantage of multiple cores. Here's an overview of creating multithreaded applications that benefit from these new processors.

Daan Leijen and Judd Hall

MSDN Magazine October 2007

Mobility: Optimize Your Pocket PC Development with the .NET Compact Framework


The .NET Compact Framework can be used to write great code and great applications. As long as you take a few things into consideration and are willing to bend a rule or two, you can have your performance cake and eat it too. In this article the authors present some neat tricks to make life as a programmer easier when using the .NET Compact Framework. Later they discuss techniques to increase performance, and decrease both load time and memory footprints. Sample code is provided.

Dave Edson and John Socha-Leialoha

MSDN Magazine December 2004

Design: Inspect and Optimize Your Program's Memory Usage with the .NET Profiler API


Developers using .NET often make memory leak tracking a low priority because the common language runtime takes care of garbage collection. What few developers realize, however, is that their objects' lifespans, along with their size and what other objects have been instantiated, all affect how they are cleaned up. Depending on the particular circumstances, these combinations can negatively affect performance, especially over the lifetime of an application. This article presents a way for developers to see memory usage and understand garbage collection using the .NET Profiler API. Along the way, a sample application to demonstrate these principles is built.

Jay Hilyard

MSDN Magazine January 2003

ScriptResource.axd throws ArgumentOutOfRangeException


I've done a lot of research on this error and I can't seem to figure it out:


Specified argument was out of the range of valid values.
Parameter name: utcDate

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: utcDate

Source Error: 

WebResource.axd - Padding is invalid and cannot be removed error



I'm working on a site that is hosted externally, and the admin just sent me an email syaing they're getting this following error:


Event code: 3005 

Event message: An unhandled exception has occurred.

Event time: 11/17/2008 8:11:24 AM

Event time (UTC): 11/17/2008 8:11:24 AM

Event ID: 5d3b54c09a24463ca8fb03f22692e0bb

Event sequence: 731

Event occurrence: 3

Event detail code: 0

Application information:

Application domain: /LM/W3SVC/1776482879/ROOT-1-128713348984007217

Trust level: Full

Application Virtual Path: /

Application Path: D:\....

Machine name: ****

Process information:

Process ID: 2272

Process name: w3wp.exe

Account name: ****

Exception information:

Exception type: CryptographicException

Exception message: Padding is invalid and cannot be removed.

Request information:

Request URL: http://sitename/WebResource.axd?d=_O9D297IUE-qcgMP0yFe-w2&t=633468747532779057

Request path: /WebResource.axd

User host address:


Is authenticated: False

Authentication Type:

Thread ac

access denied Scriptresource.axd

HiMy web site does not seem to work and showing this error.I am using an ajax control toolkit update panel. When I click anything which is in the in the update panel I have the following error."access denied Scriptresource.axd" .But only in IE. With crome it works fine.I tried to google it but didn't get any concrete answer.any help??

Optimize Calculated Measure containing COUNT EXISTING

Hi, My goal is to change the text color of all cells that contain aggregated values. Currently I achieve it like this: I COUNT the members of all attributes of all dimensions. To be multi-select-safe I am using the EXISTING keyword. If the members count of at least one dimension is not 1 than the background color of the cell is changed. CREATE MEMBER CURRENTCUBE .[Measures].[SingleCellSelected]   AS iif ((COUNT (Existing ([Dim1].[Attr1].[ Attr1].MEMBERS ))=1) AND (COUNT (Existing ([Dim1].[Attr2].[Attr2].MEMBERS ))=1) AND (COUNT (Existing ([Dim2].[Attr3].[Attr3].MEMBERS ))=1) AND (COUNT (Existing ([Dim2].[Attr4].[Attr4].MEMBERS ))=1) AND (COUNT (Existing ([Dim3].[Attr5].[Attr5].MEMBERS ))=1),1,0),   VISIBLE = 0  ;    SCOPE ([Measures].AllMembers ); FORE_COLOR (this ) = iif ([Measures].[SingleCellSelected]=1,0,16744448); END SCOPE ; This approach works but it performs badly with attributes with many members. Do you have any idea how to optimize this? Thank you!

proc taking 48 sec to run how to optimize

Hi All, i had wrote a dynamic procedure to calculate the values yearly.Now its taking 58 sec to execute and i have to reduce the execution time(3-4 sec).I had used 6 #temp in it and all the table have clusterd index on it.So plaese tell me what i have to ? I am working on sql server 2000. Your help is appreciated.Thank's

Please help me optimize this Overlap query

Hi, I have 2 tables: Table1: ls_activated (125,450 records) , screenshot: http://img180.imageshack.us/img180/3282/lsactivated.png Table2: alu (1,194,734 records), screenshot: http://img441.imageshack.us/img441/443/rmskalu.png I want to find how many ALU that are in  a ls_activated record's interval (start-end). basically i want to find the overlapped regions of these two tables (they have to be on the same chromosome) For example: if a ls_activated record has start-end from 3-10, any ALU records that has start-end position that in 1-10 is considered matching. ls_activated:                     3 |---------------------------------------! 10 ALU                              1 |-----------| 5 ALU                                                                          &nbs


Hi, I was asked a scenario in a interview. A table has a index on CityName.A query is constructed using the City name in where clause.There can be many customers in that city.How do we optimize that query. Regards Janet

looking for optimize way...please help

here a below table and the output I am looking for by some isert/update...here I need an extra column in sach a way that MAX order number is set to 1...what are the other way to optimize below query, CREATE TABLE X(step_id varchar(50), step_order int) INSERT INTO X VALUES ('A', 1) INSERT INTO X VALUES ('B', 2) INSERT INTO X VALUES ('C', 2) DECLARE @TBL TABLE (step_id varchar(50), step_order int, is_max BIT) INSERT INTO @TBL SELECT step_id, step_order, 0 AS 'is_max' FROM X DECLARE @MAX_ID INT SELECT @MAX_ID = MAX(step_order) FROM X UPDATE @TBL SET is_max = 1 WHERE step_order = @MAX_ID SELECT * FROM @TBL  

ScriptResource.axd is throwing Server Error (500)


I have page that works ok on localhost, but it throws an error on server.  This pages was working ok before until I added additional grid to updatePanel.  Is there any limit how many grids you can have in updatePanel.  The error message is below. 

Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 4723
Char: 21
Code: 0

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