Which .NET class does represent the main CONTROLLER class for WebForms ?

Posted by Renato Gama on Stack Overflow See other posts from Stack Overflow or by Renato Gama
Published on 2011-03-20T19:08:19Z Indexed on 2011/03/20 19:21 UTC
Read the original article Hit count: 302

Filed under:
|
|
|

Hey guys, lately I was studying a bit of Java, when I was taught about a way to implement a controller class, whose resposibility is to redirect the request to an Action, which perfoms a specified work. That was the way I learnt;

@Override
protected void service(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {

    try {
        String clazz = req.getRequestURI().replaceAll(req.getContextPath() + "/", "").replaceAll(".java", "");
        ((Action)Class.forName("com.myProject.actions." + clazz).newInstance()).execute(req, res);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

I know that WebForms also works with HANDLERS, which are kind of actions. For example, each .aspx page inherits from a Page object which is a handler for that specified page.

What I couldn't figure out is, which class does get request first and translate it to the specified action (page handler)? Is it a WebForms feature(implementation) or its a IIS resposibility? So, which class represent the main controller for WebForms?

Thank you very much.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET