Is the code just an ASP.NET header and footer?

I have a global header and footer with a database connection and disconnect in the header and footer, and you need to convert it to ASP.NET - this needs to be done before any HTML code is output and after any HTML is output footer code.
I can’t find any simple way to do this, for example, in classic ASP - if possible, send an example or a link to one, and do not specify this technique, thanks.


In a little more detail, I have a SQL Connection string, and then one SQL object that I want to use on all pages on the website - with a connection string and declarations in the header and disconnect in the footer.

+1
source share
5 answers

Using the terms "Header and Footer" allows many to assume that you are actually going to create HTML that forms the visible header and footer in the output. Therefore, the number of links to the master page in the responses.

However, I am going to guess in a different direction. You have a classic ASP page that includes the embedded code from the included file, then sequentially the body on the ASP main page uses the material created in include, then there is the final file with the file below that organizes the material created in the first inclusion.

ASP.NET , script, ASP. Page_Load, Page_Unload.

, ? , ASP- ASP.NET. , ( ) ASP.NET , ASP.NET. , ASP.NET, .

+3

, ASP, . - , -.

+3

UserControl ( , ), . , , ....

+1

I think you could look at this using the main page - display a connection to the content pages through the property.

In fact, I do not quite understand what you mean by your question - you should probably take a look at the life cycle of an asp.net page.

You can create your connection at the beginning of page processing and kill it when you finish with it on the page - you can do all this without the main page.

+1
source

All Articles