0

我刚刚开始学习 ASP.Net,但我遇到了一些我不知道它是如何工作的东西。假设我有一个看起来相同的“主页”,但取决于 GET 值“页面”说我应该尝试加载某个页面而不更改主要内容。我有一个 index.aspx,每当我转到 index.aspx?page=login 时,它都应该尝试加载 login.aspx。

当然可以,但是它会写出 ASP.Net 代码而不是对其进行处理。不像 PHP 的 include()。

我试过的是: Response.WriteFile() 没有运气......

这是因为,我有一个 index.aspx,它的 runat 服务器 id 为 Content 并且我想加载的任何页面都会去那里。所以我不必重新创建我制作的每一页。

有什么建议么?

4

1 回答 1

2

I think you should look at Master Pages. ASP.NET master pages allow you to create a consistent layout for the pages in your application.

A single master page defines the look and feel and standard behavior that you want for all of the pages (or a group of pages) in your application.

You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.

ASP.NET Master Pages - MSDN

于 2012-06-02T17:44:55.947 回答