hi
in deafult.aspx page I used hidden field to save localstorage value
below are codes:
<script type="text/javascript">
$(function () {
var selctedMenuHtml = $('[id*=hdnFieldID]').val();
//alert(selctedMenuHtml);
var selectedMenu = $.grep($('[id*=MM21] ul a'), function (ele) {
return $(ele).html().trim() == selctedMenuHtml.trim();
}).pop();
$(selectedMenu).addClass('SelectedActiveMenu');
$(selectedMenu).focus();
});
<script type="text/javascript">
$(function () {
$('li a').on('click', function () {
localStorage.setItem("SelectedMenu", $(this)[0].innerHTML);
$('#hdnFieldID').val(localStorage.getItem('SelectedMenu'));
});
});
</script>
<input id="hdnFieldID" type="hidden" name="hdnFieldID" runat="server">
and there is button that when click on it, it will redirect to other page
problem is that when I click on button below error happen:
A potentially dangerous Request.Form value was detected from the client (hdnFieldID=" <span class="dc-mega...").
Description: ASP.NET has detected data in the request that is potentially dangerous because it might include HTML markup or script. The data might represent an attempt to compromise the security of your application, such as a cross-site scripting attack. If this type of input is appropriate in your application, you can include code in a web page to explicitly allow it. For more information, see http://go.microsoft.com/fwlink/?LinkID=212874.
Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (hdnFieldID=" <span class="dc-mega...").
best regards
Neda