Solved

why global.asax missing a method ?

Posted on 2015-02-06
4
95 Views
Last Modified: 2015-02-13
I am using ASP.NET MVC. But  I am missing  methods  RegisterRoutes and registerGlobalFilters  in global.asax.

I contains only the following method. Why ? Should I have to add those method manually ?

// Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
    }

Open in new window

0
Comment
Question by:Varshini S
  • 3
4 Comments
 
LVL 22

Expert Comment

by:Snarf0001
Comment Utility
Don't recall what version of MVC it was (3 maybe), but those methods were moved by default into their own classes in App_Start.  They should be in there.
0
 
LVL 22

Expert Comment

by:Snarf0001
Comment Utility
Should note as well, doesn't really matter.  If you're more comfortable having them in there, move them back, the default templates just started putting them in their own classes and in a different folder.
0
 

Author Comment

by:Varshini S
Comment Utility
Snarf0001: You are correct. It is MVC 3. It is in App_start folder. But I did not get you  about move them back to own classes. How ?
0
 
LVL 22

Accepted Solution

by:
Snarf0001 earned 500 total points
Comment Utility
Well, if you wanted to, you could just move the individual functions RegisterRoutes, RegisterBundles etc out of their individual classes and back into global.asax and call them directly.

But would be work for no real, point, they're better structured and encapsulated in the app_start.
I would just use them from there.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now