Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-01-19
7
Medium Priority
?
893 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
  • 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

824 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