Click here to Skip to main content
15,904,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
if (obj1 > 0)

                return RedirectToAction("http://localhost:53500/page1/index");

            else
                return RedirectToAction("Login", "Login");



if condition is satisfied I want to redirect to the page mentioned in the url.
I had written the above code but not working..
Please help
Posted
Comments
Richard C Bishop 27-May-14 16:10pm    
Without context, your code does not make sense.

RedirectToAction accepts Action name and controller name. If you want to assign the Url the give the specified Action and Controller i.e. from your code
return RedirectToAction("Index","page1")
Thanks
 
Share this answer
 
RedirectToAction method has different types of forms it takes 1 to 6 types of arguments depending upon our requirement we need to use suitable form.

Here you can use RedirectToAction with two parameters method, both are string type parameters.First parameter is Action name and second is Controller name as below

return RedirectToAction("ActionName", "ControllerName");



More information please go through the below link
http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction(v=vs.118).aspx[^][^]

Thanks,
--RG
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900