How can I take more control in ASP.NET?

前端 未结 7 669
感情败类
感情败类 2020-12-22 16:25

I\'m trying to build a very, very simple \"micro-webapp\" which I suspect will be of interest to a few Stack Overflow\'rs if I ever get it done. I\'m hosting it on my C# in

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 16:56

    I would create an HTTP module that handles routing (similar to MVC but not sophisticated, just a couple if statements) and hand it to aspx or ashx pages. aspx is preferred since it's easier to modify the page template. I wouldn't use WebControls in the aspx however. Just Response.Write.

    By the way, to simplify things, you can do parameter validation in the module (as it shares code with routing probably) and save it to HttpContext.Items and then render them in the page. This will work pretty much like the MVC without all the bell and whistles. This is what I did a lot before ASP.NET MVC days.

提交回复
热议问题