Use the BasePage class in Web project development (inherit system.web.ui.page)

zhaozj2021-02-16  66

In Web project development, we must connect to a database per page. Is it possible to instantiate the database object per page? Of course, we can write a class that inherits the Page class. As long as we inherit this class each, you can call such an attribute that you can call. In this class, we can also join some of the features that are often used in some projects.

Take C # as an example, list code.

Using system;

Using system.diagnostics;

Using system.Web;

Using DBLAYER;

Using system.Web.ui.webcontrols;

Namespace Gamelayer

{

///

/// Basepage's summary description.

///

Public class basepage: System.Web.ui.page

{

///

Add page title when /// initialize, add a universal delete prompt function.

///

Public Basepage ()

{

String JS = "