如何在运行时创建Asp.NET .aspx页面? [英] How to create Asp.NET .aspx Page at Runtime ?

查看:60
本文介绍了如何在运行时创建Asp.NET .aspx页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时创建aspx页面,并添加其内容
如控件和文本

解决方案

阅读此链接
http://p2p. wrox.com/asp-net-1-x-2-0-application-design/4404-dynamic-creation-web-pages.html [ 解决方案

read this link
http://p2p.wrox.com/asp-net-1-x-2-0-application-design/4404-dynamic-creation-web-pages.html[^]


To implement what you want to achieve you need to fully udnerstand how ASP.net request processing architecture works. So i''ll suggest you first understand how ASP.net works and re-analyze your requirements.

I can provide some logic here. lets divide the requirements in possible sections:

1- Create a user interface where you will provide stuff to add to your asp.net page. i.e. controls and text
2- A storage for the information you have added in point 1 with some unique idnetifier say dynamicpage.aspx.
3- Provide the user link to your newly created page.

Now we''ll go into details:
Point # 1: You need to decide how will you supply information to a system that will generate .aspx page for you. you can create an IDE have some options or textbox for some script information.

It wont be easy because you need to pass:
a- event binding information like what will happen when user will click a button on dynamic page
b- Data binding information like from where will the page fetch data and to which control what information will be assigned.
c- decision making statements if your page do some decision making process you would need to pass true & fail information to it - like if a=100 then redirect to page a otherwise page b.

Point # 2: The information you have passed in Point # 1 you need to store it somewhere so that when user will hit the link to your newly created page the iis will pass the information to ASP.net to process now you will need either:
a- locate the aspx file on disk.
b- if a custom handler exists it will pass the request to it. Now the custom handler should do some url routing to the pagewhich will do a url routing to a specific page who will see the parameter and fetch the information from some custom storage (may be a database or some flat file...)

Point # 3: You need to decide that how will the user can request for dynamic page. if a link how will you generate the link and where will you add it. if its a redirection how will redirection happen.

Its not impossible but it is very difficult.

Thanks,
Hemant


这篇关于如何在运行时创建Asp.NET .aspx页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆