小编Jer*_*man的帖子

"解密表单cookie时,"在加密操作期间发生错误"

我已经将我的网站上传到网站主办,这个错误出现了;
' 在加密操作期间发生错误.'.

我做了一些研究,似乎将经过形式化的cookie绑定到MachineKey(使用webhost时有所不同).


我找到了一个方法来解决这个问题,但错误仍然存​​在.

码:

/// <summary>
    /// This method removes a cookie if the machine key is different than the one that saved the cookie;
    /// </summary>
    protected void Application_Error(object sender, EventArgs e)
    {
        var error = Server.GetLastError();
        var cryptoEx = error as CryptographicException;
        if (cryptoEx != null)
        {
            FederatedAuthentication.WSFederationAuthenticationModule.SignOut();
            Global.Cookies.FormAuthenticated Cookie = new Global.Cookies.FormAuthenticated();
            Cookie.Delete();
            Server.ClearError();
        }
    }
Run Code Online (Sandbox Code Playgroud)


堆栈跟踪:

[CryptographicException: Error occurred during a cryptographic operation.]
   System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input) +115
   System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Unprotect(Byte[] protectedData) +59
   System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket) …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net cryptographicexception

37
推荐指数
9
解决办法
5万
查看次数

使用没有子元素的javascript将HTML元素DOM作为字符串获取

我想知道是否有任何方法来获取一个没有子元素作为字符串的html元素/节点.
这个问题可能看起来像这个问题的重复:jQuery,获取整个元素的html.
但我只希望html元素本身作为一个字符串,没有它的孩子.

texts.push({title:'[#target, outerHTML]', value: $input[0].outerHTML});
texts.push({title:'[#target, $.html()]', value: $input.html()});

texts.push({title:'[#bigger_Target, outerHTML]', value: $('#bigger_Target')[0].outerHTML});
texts.push({title:'[#bigger_Target, $.html()]', value: $('#bigger_Target').html()});

texts.push({title:'[#target, DESIRED]', value: '<input class="test" data-type="text only" type="button" value="Test />"'});
texts.push({title:'[#bigger_Target, DESIRED]', value: '<div id="bigger_Target" />'});
Run Code Online (Sandbox Code Playgroud)

FIDDLE:
http ://jsfiddle.net/ttoom9hc/12/

来自其他帖子的FIDDLE:http :
//jsfiddle.net/u6avkvz0/

javascript jquery tostring filter

1
推荐指数
1
解决办法
714
查看次数