Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi Friends,
Here i have an url.
www.abc.com
now i want if i enter
www.abc.com/Faq
then it should redirect to Faq page using Account Controller.

Here i am using this code.

Global.ascx Page Code
routes.MapRoute(""
               , "Faq"
                 , new { controller = "Account", action = "Faq" });

Controller Code
public class AccountController : Controller
    {
        public ActionResult Faq()
        {
            return View();
        }
    }

Now i want to open Faq.cshtml if i entered url www.abc.com/Faq

can you help me how can i redirect to page "Faq" whose action method contained in Account Controller.

i want url
www.abc.com/Faq

insted of
www.abc.com/Account/Faq


Please do needful....................
Thanks
Posted
Updated 31-Aug-12 2:05am
v6

1 solution

You should use Web.config defaultDocument[^], and you can even put a web.config in each folder, and inside that config just have the default document set.



--Amit
 
Share this answer
 
v4
Comments
sunandandutt 31-Aug-12 6:24am    
Not Working............
_Amy 31-Aug-12 6:25am    
Did you tried? What you tried show me.
sunandandutt 31-Aug-12 7:18am    
You have deleted the code so can you tell me how can i do this.?
_Amy 31-Aug-12 7:23am    
You should not post your code in my answer. Try using comment or improve your question. And also copy pasting will not enhance your knowledge, try using the similar logic given in the link. :)

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