We're getting a bunch of errors in our web application now that state the following:
An error occurred at 8/21/2006 2:59:33 PM on: /WebResource.axd?d=MwosQXNAI7L8kBKDzT5LZsvGAWnsnq6C3NiO275SEoM1&t=632888115724576432
Padding is invalid and cannot be removed.
Source:mscorlib
I've done some searching and have seen that some problems have been due to web farms with .net 2.0 and a solution was to generate a unique machine key that all servers use. We aren't using a web farm, though I did try this solution to no avail.
Does anyone out there have any experience with this issue?
I discovered more details on the issue, that may, or may not help.
We use a 3rd party search utility on our site, SLI Systems. A users searches on our site and gets redirected to a results page which is hosted by SLI (they have search results based on a feed we give them daily).
When a user clicks a link on the results page they come back to our site, at which point the exception is thrown. The user nevers sees an error, however I receive an email with the exception. The user is oblivious to it, so its not an issue there, just an
issue where seeing the emails with the exception is annoying. :-)
Actually, I checked closer, and its when the results page for the search loads and probably requests CSS, javascript, and image files that our search provider requests from our site.
We also have two sites running in production that use the same search configuration that (from what I can tell anyway) are configured the same. I see the error on one site, but not on the other. So I'm fairly confident it has nothing to do with the framework
installed on the production server being different from the development servers (never see the error in development).
Is there possibly some sort of configuration for this Web Resource stuff that I'm missing?
I solved my own problem. SLI, who does our search, uses a rendered ASP .NET page we make available to them to get the content for our search page. That content included a reference to WebResource.axd and values on the url for that request were no longer valid,
hence the error. Once removed, it should work fine.
I am currently getting the error described in the first post of this thread in the error log of one of my production applications.
I've discovered that if a validly encrypted value that's old (from an expired session) gets posted to the /ScriptResource.axd handler the "Padding is invalid and cannot be removed" error will occur. I am also experiencing a "Exception has been thrown by
the target of an invocation" error message from the same issue.
I have also tried posting a garbage value (that I know is not a validly encrypted value) to the /ScriptResource.axd handler and I recieved a "This is an invalid script resource request" error.
My conclusion is that the "Padding is invalid and cannot be removed" error is probably being caused by the users session expiring and then the browser is loading a cached version of the page, but is still requesting the script resource referenced in the
cached page from the server.
From my research on what causes this error, I also read that if you have two web servers hosting the site, you can also get this error if the key in the machine.config isn't the same for both servers.
Hope this helps.
Below are details for one of the errors that showed up in my error log.
Page Requested:
http://[MyWebSite]/WebResource.axd?d=j1YZVaNH7F7BnEkdAiVj0A2&z=0 Error Message: Padding is invalid and cannot be removed. Exception: System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
at System.Web.UI.Page.DecryptString(String s)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at Microsoft.Web.Handlers.WebResourceCompressionModule.OnPreRequestHandlerExecute(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The user nevers sees an error, however I receive an email with the exception. The user is oblivious to it, so its not an issue there, just an issue where seeing the emails with the exception is annoying. :-)
this is exactly the situation im in - user never sees error yet i get a bunch of emails every morning. what concerns me is that the main search engine crawlers also experience this error when they crawl the page and i wonder if it affects the indexing.
its only happening on pages with a script manager/update panel. and comes from the query string in the reference to webresource.axd
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.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
When I tried to access it directly I got the same CryptographicException. Need to find out how to fix that. Further errors continue to occur from time to time.
billr578
Member
641 Points
134 Posts
Padding is invalid and cannot be removed
Aug 21, 2006 07:03 PM|LINK
An error occurred at 8/21/2006 2:59:33 PM on: /WebResource.axd?d=MwosQXNAI7L8kBKDzT5LZsvGAWnsnq6C3NiO275SEoM1&t=632888115724576432
Padding is invalid and cannot be removed.
Source:mscorlib
I've done some searching and have seen that some problems have been due to web farms with .net 2.0 and a solution was to generate a unique machine key that all servers use. We aren't using a web farm, though I did try this solution to no avail.
Does anyone out there have any experience with this issue?
Thanks!
Regards,
Bill Rowell
The Fright Catalog
http://www.frightcatalog.com
YumDrop
http://www.yumdrop.com
http://billrowell.com/
billr578
Member
641 Points
134 Posts
Re: Padding is invalid and cannot be removed
Aug 21, 2006 10:10 PM|LINK
We use a 3rd party search utility on our site, SLI Systems. A users searches on our site and gets redirected to a results page which is hosted by SLI (they have search results based on a feed we give them daily).
When a user clicks a link on the results page they come back to our site, at which point the exception is thrown. The user nevers sees an error, however I receive an email with the exception. The user is oblivious to it, so its not an issue there, just an issue where seeing the emails with the exception is annoying. :-)
http://billrowell.com/
billr578
Member
641 Points
134 Posts
Re: Padding is invalid and cannot be removed
Aug 22, 2006 12:35 AM|LINK
http://billrowell.com/
billr578
Member
641 Points
134 Posts
Re: Padding is invalid and cannot be removed
Aug 22, 2006 03:22 PM|LINK
Is there possibly some sort of configuration for this Web Resource stuff that I'm missing?
http://billrowell.com/
billr578
Member
641 Points
134 Posts
Re: Padding is invalid and cannot be removed
Aug 22, 2006 07:30 PM|LINK
http://billrowell.com/
crpietschman...
Participant
917 Points
221 Posts
Re: Padding is invalid and cannot be removed
Mar 06, 2007 04:03 PM|LINK
I am currently getting the error described in the first post of this thread in the error log of one of my production applications.
I've discovered that if a validly encrypted value that's old (from an expired session) gets posted to the /ScriptResource.axd handler the "Padding is invalid and cannot be removed" error will occur. I am also experiencing a "Exception has been thrown by the target of an invocation" error message from the same issue.
I have also tried posting a garbage value (that I know is not a validly encrypted value) to the /ScriptResource.axd handler and I recieved a "This is an invalid script resource request" error.
My conclusion is that the "Padding is invalid and cannot be removed" error is probably being caused by the users session expiring and then the browser is loading a cached version of the page, but is still requesting the script resource referenced in the cached page from the server.
From my research on what causes this error, I also read that if you have two web servers hosting the site, you can also get this error if the key in the machine.config isn't the same for both servers.
Hope this helps.
Below are details for one of the errors that showed up in my error log.
Page Requested: http://[MyWebSite]/WebResource.axd?d=j1YZVaNH7F7BnEkdAiVj0A2&z=0
Error Message: Padding is invalid and cannot be removed.
Exception:
System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
at System.Web.UI.Page.DecryptString(String s)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at Microsoft.Web.Handlers.WebResourceCompressionModule.OnPreRequestHandlerExecute(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Blog: http://pietschsoft.com | Web.Maps.VE - ASP.NET AJAX Bing Maps Control
Norton
Member
22 Points
14 Posts
Re: Padding is invalid and cannot be removed
Mar 23, 2007 12:30 AM|LINK
We had the same error in our NLB settup. We had consistent machineKeys, but were still getting the error.
The problem was we were missing the decryptionKey=, and that appearantly made a different d= value, and made all machines consistent.
Read my writeup here for more info:
http://blog.aproductofsociety.org/?p=11
RandomGuy
Member
16 Points
7 Posts
Re: Padding is invalid and cannot be removed
Nov 04, 2007 11:00 AM|LINK
this is exactly the situation im in - user never sees error yet i get a bunch of emails every morning. what concerns me is that the main search engine crawlers also experience this error when they crawl the page and i wonder if it affects the indexing.
its only happening on pages with a script manager/update panel. and comes from the query string in the reference to webresource.axd
rfurdzik
Contributor
3439 Points
1731 Posts
Re: Padding is invalid and cannot be removed
Nov 21, 2007 06:52 PM|LINK
How do I fix this? I have MachineKey defined machine.config. But I am just running this on development machine. This is the URL and error:
http://localhost/IwantIoffer/App_Themes/Blue/WebResource.axd?d=FmMZAybqdKY82S4y_btZrsik_rRRHSnDyhoZkd_CwLIpjjfh_hXAI4WwqXK5cN4pXfQCKyFiP-mk3xSykYU-9Q2&t=633083970300000000
Server Error in '/IwantIoffer' Application.
Padding is invalid and cannot be removed.
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.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
Source Error:
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.1378; ASP.NET Version:2.0.50727.1378
Version Information: Microsoft .NET Framework Version:2.0.50727.1378; ASP.NET Version:2.0.50727.1378
Thsi is what I have added to my web.config on the development mchine, but still the same problem:
<
machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="SHA1" />Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
Vadim Gavril...
Member
6 Points
3 Posts
Re: Padding is invalid and cannot be removed
Dec 01, 2007 02:03 PM|LINK
The same exception occurs from time to time on my web-site.
Here is the description:
System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
at System.Web.UI.Page.DecryptString(String s)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Not too much data, huh?
I believe this is caused by asp .net treeview control I'm using. Here is a part of HTML-code cached by search engines:
<img alt="Skip Navigation Links." src="/WebResource.axd?d=yk-6AGf8S_OJNDxtYLVmpw2&t=633042227750781250" width="0" height="0" border="0" />
When I tried to access it directly I got the same CryptographicException. Need to find out how to fix that. Further errors continue to occur from time to time.
Vadim Gavrilyuk
http://eTutorials.org/
http://etutorials.org/