Here is my problem:
window.location.href = "(X(1)S(" + "@Session.SessionID" + "))/Cart/AddToCart?productID=" + "@Model.ProductID";
Basically on click of <p> tag I want to call this link with sessionID in the url. The problem is it either doubles the sessionID part or it adds the whole string at the end of current url. When I remove this part "(X(1)S(" + "@Session.SessionID" + ")) everything works fine. Any ideas why it’s doing that?
Solution:
I have no idea why did I get two negative votes, but the issue was, I needed a ‘/’ before the session ID. That’s it!
Depending on how your session handler is passed, it may get appended automatically to any URL, so that you don’t have to do it yourself. Since you’re doing it yourself anyway, it gets doubled up by the automatic one.