Setting a URL hash from Silverlight sometimes fails

In our silverlight application, we set the hash property in the browser window to bookmark the current request and request parameters. This is done through javascript through Silverlight, for example:

var hashCode = "Example.ControlNamespace.ClassName?clientID=62189";
HtmlPage.Window.Eval(string.Format("window.location.hash='{0}'", hashCode));

This works pretty well, but we get intermittent errors from the production process when it doesn't work with the stack track that ends on this line.

System.InvalidOperationException: Eval failed. in System.Windows.Browser.HtmlWindow.Eval (String Code)

This only happens sometimes, but I would like to know what causes it. I was able to play it when I used IE8 myself, so I don’t think there are any obscure browsers causing this. It seems like sometimes the hash is invalid, but I don't know why. Also, if it is important to place it in a secure connection, https.

Thanks in advance.

Edit: I was able to play it again. When debugging javascript, the error was "resolved". This probably only happens the first time the page loads, so maybe the page hasn’t finished loading, and the URL hash cannot be changed until it is complete?

+5
source share
1 answer

:

HtmlPage.Window.CurrentBookmark Silverlight.

, , - , IE , ( , " " ), , , , , , HTTPS.

, , , , - , (.. , IE) ( JavaScript), Silverlight.

+4

All Articles