Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cached url with ajax version causing unhandled error with asp.net c#

Posted on 2013-01-19
7
Medium Priority
?
885 Views
Last Modified: 2013-01-26
I have a .net 4 website on IIS7 and use Ajaxcontrol toolkit. Whenever I upgrade to a newer version an ajaxcontrol toolkit, I have months when a search engine uses cached urls with the ajax version in.  The information is contained in the url query string and because the information contains an old dll version for ajax which is not available it causes an unhandled error. I would like to
1. stop this form of url if possible but dont know how.
2. handle the error and provide a 301 redirect to the correct url (less the query string)

You might need to ask me a few questions here so we can get to the route of the problem.
The current version of the Ajax tool kit Im using is 4.1.60919
This page is my example.
http://www.printer-ink-toner.co.uk/pc/brother-mfc74200-drum

Here is an example of the error.

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 1/19/2013 5:50:46 AM
Event time (UTC): 1/19/2013 5:50:46 AM
Event ID: b914df847a4e4052bc2ef31a55a74958
Event sequence: 6905
Event occurrence: 52
Event detail code: 0

Application information:
    Application domain: xxxx
    Trust level: Full
    Application Virtual Path: /
    Application Path: xxxx
    Machine name: xxxx

Process information:
    Process ID: 51616
    Process name: w3wp.exe
    Account name: xxxxx

Exception information:
    Exception type: System.IO.FileLoadException
    Exception message: Could not load file or assembly 'AjaxControlToolkit, Version=4.1.51116.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Request information:
    Request URL: http://www.printer-ink-toner.co.uk/pc/brother-mfc74200-drum?_TSM_HiddenField_=ctl00_MainContent_ToolkitScriptManager1_HiddenField&_TSM_CombinedScripts_=%3B%3BAjaxControlToolkit%2C+Version%3D4.1.51116.0%2C+Culture%3Dneutral%2C+PublicKeyToken%3D28f01b0e84b6d53e%3Aen-US%3A07ead49c-3169-4e2b-b447-bacc452e967a%3Ade1feab2%3Af9cec9bc%3Aab09e3fe%3Af2c8e708%3A87104b7c
    Request path: /pc/brother-mfc74200-drum
    User host address: 66.249.78.117
    User:
    Is authenticated: False
    Authentication Type:
    Thread account name: xxxxx

Thread information:
    Thread ID: 9
    Thread account name: xxxxx
    Is impersonating: False
    Stack trace:    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at AjaxControlToolkit.ToolkitScriptManager.ScriptEntry.LoadAssembly()
   at AjaxControlToolkit.ToolkitScriptManager.DeserializeScriptEntries(String serializedScriptEntries, Boolean loaded)
   at AjaxControlToolkit.ToolkitScriptManager.OutputCombinedScriptFile(HttpContext context)
   at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
0
Comment
Question by:nigelstephens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38797773
Hi,

I suggest you to remove all the references of AjaxControlTookit and install using NuGet -

http://roopeshreddy.wordpress.com/2012/10/07/installingconfiguring-ajaxcontroltoolkit-through-nuget/

seems like AjaxControlToolKit reference problem!

Hope it helps u...
0
 

Author Comment

by:nigelstephens
ID: 38797859
I have already uninstalled and installed with NuGet.
I dont think this is caused by Ajax installation references not being correct. Something to do with combining of scripts as in the url concerned a value for "CombinedScripts" is passed in the query string parameters.
 The error is being generated at the early point where the Toolkitscript manager is going to combine scripts. It is then trying to get the incorrect assembly reference(old version of ajaxcontrol toolkit). Is it possible to try and trap this error by creating an error handler and binding it to this code that runs. I beleive it is before the main pipeline begins but I do not fully understand this.

This might help
http://blogs.msdn.com/b/delay/archive/2007/06/11/script-combining-made-easy-overview-of-the-ajax-control-toolkit-s-toolkitscriptmanager.aspx

How do scripts actually get combined? [Technical]
 
Script combining is a two-stage process.
 
The first stage takes place during the normal ASP.NET page lifecycle when ToolkitScriptManager overrides ScriptManager's OnLoad method to initialize its state and its OnResolveScriptReference method to find out when script references are being resolved. The initialization code in OnLoad consists of adding a HiddenField to the page and using it to track which scripts have already been loaded by the browser. The handling of OnResolveScriptReferences is a little more involved: the script reference is checked for combinability (i.e., does the assembly's ScriptCombine attribute allow the script to take part in script combining) and the script reference is changed to point to the URL of a combined script file. In this manner, all scripts that are part of the same combined script file get the same URL and the ScriptManager class outputs that URL to the page exactly once. Notably, because scripts may have a strict ordering, the presence of an uncombinable script in the middle of combinable scripts will result in two combined script files being generated (the first consisting of the scripts coming before the uncombinable script and the second consisting of the scripts after it).
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:nigelstephens
ID: 38798347
Thanks for the suggestion but that is not the cause of the problem as this happens on the live website.
0
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38801528
Hi,

I tried accessing this link - http://www.printer-ink-toner.co.uk/pc/brother-mfc74200-drum and seems to be working fine!

Is there any scenario, where i can replicate the issue?
0
 

Accepted Solution

by:
nigelstephens earned 0 total points
ID: 38801546
I have managed to place a fix in place. I put some code on the error.apx page to read the forwarded url of the problem page and if it had my products location then I do a 301 redirect to the correct location. It is not a nice a fix as I was looking for but it will do for now. Thanks for your efforts!
0
 

Author Closing Comment

by:nigelstephens
ID: 38821797
Worked out a solution myself
0

Featured Post

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question