Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2003, 09:56 AM
Registered User
 
Join Date: Sep 2003
Location: Pune, Maharashtra, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic creation of Web Pages

I have a question

If I create an object of a WebForm like

WebForm1 wf=new WebForm1();

How do I create a Web Page corresponding to this WebForm

Response.Redirect("wf.aspx");// This doesn't work. Why?? How do I make it work??
  #2 (permalink)  
Old September 29th, 2003, 04:04 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you instantiate an instance of a class that is derived from System.Web.UI.Page (i.e. usually a webform) then you simply have an object instance of that class.

If you want to redirect to "webform1.aspx" then you could have to make this call:

Response.Redirect("webform1.aspx");

By passing the redirector "wf.aspx" you are redirecting to a page that isn't there (unless you also happen to have a real wf.aspx file in your project).

Keep in mind that when you redirect to another page, the framework is creating a brand new instance of the page's class. You can't instantiate your own instance of it and pass it to the redirector.

You can use the Transfer method to pass execution off to another page such that the transferred TO page sees the form post and querystring from the first page, but other than that there's not much you can do.

Peter
  #3 (permalink)  
Old September 30th, 2003, 04:48 AM
Registered User
 
Join Date: Sep 2003
Location: Pune, Maharashtra, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

fine peter,
 but what i'm tryin is to create a webform at runtime by takin in input from user. This is done offline and am tryin to build a windows utility in c# ASP.NET that will take in from user the no. of forms he wants and all the attributes he wishes to put on them.But that is a later part, as for now i need to know how do i create a webform dynamically and redirect to it at runtime?
  #4 (permalink)  
Old September 30th, 2003, 12:05 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Now I'm more confused. How can you do something "offline" in ASP.Net? I understand if you were building a windows application that created web forms, otherwise I don't see how you are going to achieve this.

You'll need to save the an ASPX file if you want to "create" a web form. You can't redirect to a page that isn't there. That simple matter remains. Unless you get into more complex methods of ASP.Net, you need to have an ASPX page to point a browser to.

It sounds like you are attempting to build a windows client application that will generate ASP.Net pages. Once you have saved the ASPX to a server, then sure, you could launch the URL to that page on that server and the default browser would open up and display the page.

Peter
  #5 (permalink)  
Old October 1st, 2003, 04:23 AM
Registered User
 
Join Date: Sep 2003
Location: Pune, Maharashtra, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes peter you are right
 i am building a windows application that will generate webforms(offline, which can then be used by the user to post on any webserver and use them for his purpose) by taking in the input from the user. The question is how do i create this form and save it onto the server at runtime. Because once that is done it then redirecting to it is no problem.
  #6 (permalink)  
Old October 1st, 2003, 08:28 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Are you going to be building pages that use purely inline server code? Cause you certainly can't deploy pages on the fly like you plan with codebehind.

All you need to do is save a new ASPX which contains all the stuff the user puts in from your win app and then copy or FTP that file to the right place on the web server. Shouldn't be too hard. If you have to do it by FTP you'll need to figure that out. I'm not sure if .Net has FTP functionality built in. Otherwise, it's just a matter of copying to the server's web folder.

You'll probably need to create a template file that the application will use then you need to "write" the html and other stuff that the VS visual designer would normally write. I don't know if there is a way to do this automatically from the component objects. I would highly doubt it is built in. The components know how to output the HTML for their own rendering to the browser, but not the html/script for a component in the ASPX. Seems like this would be a lot of work.

Peter
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic page creation DyerOppenheimer BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 June 29th, 2009 05:34 PM
Dynamic creation of Columns in datagrid p330418 ASP.NET 2.0 Basics 0 March 29th, 2008 07:33 AM
dynamic textbox creation badamsreekar ASP.NET 2.0 Professional 1 July 26th, 2007 10:40 AM
Dynamic File name creation in subscription. bsuku BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 April 5th, 2005 03:41 PM
Dynamic Folder Creation ells228 Classic ASP Basics 0 August 7th, 2003 06:06 AM



All times are GMT -4. The time now is 08:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.