System.Security.Cryptography.CryptographicException: 填充无效,无法被移除。
在 System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
在 System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
在 System.Security.Cryptography.CryptoStream.FlushFinalBlock()
在 System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
在 System.Web.UI.Page.DecryptString(String s)
在 System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
<img alt="Skip Navigation Links" height="0" width="0" src="/WebResource.axd?d=2CKFSExFft48UuCBt3w1pA2&t=632889116642854495" style="border-0px;" />上述html代码生成的地方是由SiteMapPath内部生成的,查阅了MSDN及反射查看了SiteMapPath的实现代码,发现在SiteMapPath的呈现阶段动态输出了一个图片资源:
protected internal override void RenderContents(HtmlTextWriter writer)
{
bool flag1 = !string.IsNullOrEmpty(this.SkipLinkText) && !base.DesignMode;
string text1 = this.ClientID + "_SkipLink";
if (flag1)
{
writer.AddAttribute(HtmlTextWriterAttribute.Href, "#" + text1);
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.AddAttribute(HtmlTextWriterAttribute.Alt, this.SkipLinkText);
writer.AddAttribute(HtmlTextWriterAttribute.Height, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Width, "0");
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
writer.AddAttribute(HtmlTextWriterAttribute.Src, base.SpacerImageUrl);
writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();
writer.RenderEndTag();
}
base.RenderContents(writer);
if (flag1)
{
writer.AddAttribute(HtmlTextWriterAttribute.Id, text1);
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.RenderEndTag();
}
}
internal string SpacerImageUrl
{
get
{
this.EnsureOccasionalFields();
if (this._occasionalFields.SpacerImageUrl == null)
{
this._occasionalFields.SpacerImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(WebControl), "Spacer.gif");
}
return this._occasionalFields.SpacerImageUrl;
}
}这里就找到了一个属性SkipLinkText,只要把这个属性设置为空值就不会再呈现图片资源了,这个属性干什么的?查一下MSDN吧,
SkipLinkText属性是SiteMapPath、TreeView 和 Menu 站点导航控件共有的一个属性,它的功能是"网站的每个网页上通常都使用站点导航控件。在每次访问网页和每次回发时,屏幕读取器和其他辅助设备都会朗读导航控件中的文字。用该属性可以跳过后续页或同一页面的不同视图上的重复信息。" 可以一般是用不着,所以这里就把这个属性设置为SkipLinkText=""就可以了。
