redirect to another view using razor in mvc

Posted by Klbaiju under ASP.NET MVC on 6/7/2018 | Points: 10 | Views : 3352 | Status : [Member] | Replies : 1
Hi,

After checking session value ,i want to redirect to another view using Razor syntax

following is my code

@if(Session["uname"].ToString() !="")
{
<h3>welcome ,@Session["uname"].ToString()</h3>
}
else
{

}

what should i write in the else part for moving to home/login

Regards

Baiju




Responses

Posted by: Sheonarayan on: 6/7/2018 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Reponse.Redirect("pageurl");

or write following script in else block

<script>window.location.redirect = "page url";</script>

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response