I would like to put a URL in an @Url.Content("")
.
I allow the user to choose their home page in my portal (as long as they display anything unnecessary on the home page) and I put this value in a column of my User table.
As long as this column is null I display a modal to select its home page. So once the connection returns "Success", I redirect to the correct page, but I am not able to pass a variable in @Url.Content(HERE)
with the value in my column (Example: /Home/Index
).
Here is my code:
IdentificationSucces = function(data) {
if (@Session["SpAccueilDefaut"]) {
var url = @Session["SpAccueilDefaut"].ToString();
window.location.href = '@Url.Action("" + url +"")';
} else {
window.location.href = '@Url.Content("~/Intranet/Index")';
}
};
My url
variable is in error and this is the message:
The name'url' does not exist in the current context