How to set default route in asp.net mvc application from web.config Ask Question
By   Junaid A     25-Apr-2024    2

How to set default route in asp.net mvc application from web.config

Solution:

Add Key web.config as below

  <add key="DeafaultPageAfterLogin" value="/MyOrderedMeals" />


in controller or route.config file set redirect url to


 if (ConfigurationManager.AppSettings["DeafaultPageAfterLogin"]!=null)
                    {
                       
                        return Redirect(ConfigurationManager.AppSettings["DeafaultPageAfterLogin"].ToString());
                    }


in else part you can set default route.

Solutions


10349
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM
03
07

New Messages

George Floyd
  • Edit Post Edit This Post within a Hour
  • Hide Chat Hide This Post
  • Delete Chat If inappropriate Post By Mistake
  • Report Inappropriate Chat
  • 4.5kb
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks