By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Help! How to create aspx file dynamically

P: n/a
Hi. I am using visual web developer express edition and I am using
vb.net as the programming language.

I want to create a new aspx file on a button click. I will have a
template that the new aspx file should follow. I need to pass the
values entered on the current page to the new aspx file created. But
more importantly I have problems with the creating of the new aspx
file and saving it. I need all this to be done when i am running the
program. Is this possible? Need to do this for a school project and I
am new to this.

I would appreciate any help on this. Thank you in advance.

Jul 2 '07 #1
Share this Question
Share on Google+
16 Replies


P: n/a
What is the problem you talked about without telling us what is is exactly ?

Also this as this is an unusual requirement you may want to explain what you
are trying to do.

Basically you are trying to create an application aht auto-generate a web
site (based possibly on a DB structure or something ?) Or else you are
trying to do something that could be better achieved another way (an ASPX
page could take some parameters from a DB and take this into account on the
fly).

--
Patrice
<fl*******@hotmail.coma écrit dans le message de news:
11**********************@j4g2000prf.googlegroups.c om...
Hi. I am using visual web developer express edition and I am using
vb.net as the programming language.

I want to create a new aspx file on a button click. I will have a
template that the new aspx file should follow. I need to pass the
values entered on the current page to the new aspx file created. But
more importantly I have problems with the creating of the new aspx
file and saving it. I need all this to be done when i am running the
program. Is this possible? Need to do this for a school project and I
am new to this.

I would appreciate any help on this. Thank you in advance.

Jul 2 '07 #2

P: n/a
I am creating an e-learning system in which I don't want to save the
questions that the user enters in a database. Instead, I want to save
them as an aspx file. (This is not my choice though, its what my
lecturer wants. Reason being that its easier to manage and its more
organized.)

There's a page that I've created and I want to use that as the
template for the new file.

After the user enters the questions and click on the submit button, it
will automatically copies the template, saves it as another name and
replace the default values with the new set of questions.

Is there any way I could code the function inside the vb file or
something?

Thank you.

Jul 2 '07 #3

P: n/a
<fl*******@hotmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
Is there any way I could code the function inside the vb file or
something?
You could pretty much do anything you like given time, resources, and server
permissions... :-)

Patrice is right, though - this is crying out for a database solution.

However, when you talk about your "lecturer", I'm assuming this is some
project you're working on as part of your education, so I guess you'll have
to do what you're asked to do if you want to pass... :-)

Maybe a reasonable question would be to ask your lecturer if it absolutely
*has* to be an aspx file, or whether you could save the data into another
file format e.g. XML or even just plain text. Then you could load the
relevant file into an aspx page to display it as and when required...

Anyway, persuading the .NET Framework to create a text file (as that's all
an aspx is) is a trivial task, so long as the process that ASP.NET is
running under has write permissions on the folder in question:

http://msdn2.microsoft.com/en-us/library/ms404278.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 2 '07 #4

P: n/a
IMHO this is an academic, non real world design (I'm not sure how this is
"easier to manage" and "more organized" than saving questions in a database
when you can easily edit them etc...).

You still don't tell what us what you means by "I have problems with the
creating of the new aspx file and saving it". ASPX files are just text files
thought the web application will have to compile them (for example it could
be an encoding issue).

Also I assume you are talking about creating question pages. How do you plan
to store corresponding responses ? It could be usefull to know before
desining the whole solution (in a DB you could easily link each response
with the corresponding question and creates whatever reports you want, with
"dead text" burried in ASPX text files I'm not sure how you want to handle
those responses).

---
Patrice

<fl*******@hotmail.coma écrit dans le message de news:
11*********************@i13g2000prf.googlegroups.c om...
>I am creating an e-learning system in which I don't want to save the
questions that the user enters in a database. Instead, I want to save
them as an aspx file. (This is not my choice though, its what my
lecturer wants. Reason being that its easier to manage and its more
organized.)

There's a page that I've created and I want to use that as the
template for the new file.

After the user enters the questions and click on the submit button, it
will automatically copies the template, saves it as another name and
replace the default values with the new set of questions.

Is there any way I could code the function inside the vb file or
something?

Thank you.

Jul 2 '07 #5

P: n/a
Yes. I know a database solution would be best. I tried reasoning him
over that matter for weeks and weeks. =X

I will take the idea you suggested into consideration. But if I save
it as text file and when I call it when I display it on aspx, will I
still be able to run checks on them?

Because its supposed to be quiz. The lecturer enters the questions and
then save them. When a student logs in and do the quiz, I still need
to handle the right or wrong answers and then calculate the scores.

More suggestions will be deeply appreciated. Thank you for replying.

Jul 2 '07 #6

P: n/a
<fl*******@hotmail.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.com...
Yes. I know a database solution would be best. I tried reasoning him
over that matter for weeks and weeks. =X
Then I would seriously question his competence to teach this subject, as he
clearly knows very little about it... I suggest you show him this newsgroup
thread...

He is also deliberately forcing you to use totally the wrong solution - and
a solution which you already know to be wrong, and which you would never use
in the "real world"...

Therefore, if I were you, I'd have to seriously question what on earth I was
even taking this person's class, as I would doubt very much whether you will
learn anything useful...
I will take the idea you suggested into consideration. But if I save
it as text file and when I call it when I display it on aspx, will I
still be able to run checks on them?
If you save the data as an XML file, you can certainly treat it just like a
database. Again, it's not really the correct use of XML, but it would
certainly be much better than saving your data in an aspx page - this really
is *TOTALLY* the wrong thing to do...
Because its supposed to be quiz. The lecturer enters the questions and
then save them. When a student logs in and do the quiz, I still need
to handle the right or wrong answers and then calculate the scores.
I think that while your lecturer is incapable of understanding how stupid
what he is asking you to do is, you're pretty much wasting your time...

Does he even understand what a database is...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 2 '07 #7

P: n/a
Actually, he doesn't have much knowledge on IT. He is not teaching me
anything related to IT. Thats why I am here to do this project. I
think I've got no other choice but to reason with him over this again.
Hehe. Thank you for all your help. I appreciate it. =)

Jul 2 '07 #8

P: n/a
<fl*******@hotmail.comwrote in message
news:11**********************@g37g2000prf.googlegr oups.com...
Actually, he doesn't have much knowledge on IT. He is not teaching me
anything related to IT. Thats why I am here to do this project. I
think I've got no other choice but to reason with him over this again.
Hehe. Thank you for all your help. I appreciate it. =)
Well, another possible angle might be to use an XML file, but call it
something like questions.aspx - the file extension doesn't actually
matter... ;-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 2 '07 #9

P: n/a
I'm having the same problem i think. Have created some html pages dynamically
and on one page i would like a contact form; name, address, email etc.

This need to be done as an aspx page. Ive created the aspx page then saved
the dynamic website. On viewing, i see only the headings but no boxes or send
button.

I havent seen any as.net code for this, only part asp.net v2.0 code which
the site isp doesnt support.

Any ideas, thanks
Jul 2 '07 #10

P: n/a
"stevep" <st****@discussions.microsoft.comwrote in message
news:C9**********************************@microsof t.com...
I'm having the same problem i think. Have created some html pages
dynamically
and on one page i would like a contact form; name, address, email etc.

This need to be done as an aspx page. Ive created the aspx page then saved
the dynamic website. On viewing, i see only the headings but no boxes or
send
button.

I havent seen any as.net code for this, only part asp.net v2.0 code which
the site isp doesnt support.

Any ideas, thanks
Firstly, what are you actually doing?

Why have you created HTML pages dynamically? What is the purpose of this?

What do you mean by "saved the dynamic website"?

I'm really struggling to think of any scenario where it would be necessary
to create additional aspx pages dynamically...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 2 '07 #11

P: n/a
Im new to web design as you probably can tell. Ive started using expression
web and this is the way you seem to do it, probably completely wrong mind.

I thought that creating dynamic pages was that you have one main page and
each time you make changes it saves these changes to all the pages in your
site. For example i converted all the htm pages to asp as suggested on
another thread. I had to save each one individually. Would i have to apply
changes i did on one page to each page manually if i were to use asp?

it seems to me that forms can only be done in asp in which case i would need
all my pages as .asp & the form page as .aspx so the form standard is the
same throughout.

Jul 2 '07 #12

P: n/a
yup pc crashed, didnt think it came out first time...

Logged into the web hosting account and my account is only enabled for ASP
not ASP.NET or ASP.NET 2.0

Not knowing the difference between ASP & ASP.NET im guessing its having an
effect
Jul 2 '07 #13

P: n/a
"stevep" <st****@discussions.microsoft.comwrote in message
news:43**********************************@microsof t.com...
yup pc crashed, didnt think it came out first time...
Fair enough...
Logged into the web hosting account and my account is only enabled for ASP
not ASP.NET or ASP.NET 2.0
Ah...
Not knowing the difference between ASP & ASP.NET im guessing its having an
effect
It certainly is! Following on from my previous reply, you're unfortunately
*still* in the wrong newsgroup - the ASP one is:
microsoft.public.internetserver.asp.general

However, as you're using Expression, the Expression newsgroup is probably
your best starting point...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 2 '07 #14

P: n/a
A dynamic page is a page that "runs" server side to produce a resulting HTML
code. As the page runs server side it can do whatever you want such as
taking the current/datetime or using data from a DB to create the resulting
HTML code.

I'm not sure what you are talking about but it would be more likely a master
page or CSS stylesheet (basically a master page define the general layout
for a whole site while a CSS stylesheet defines still more details such as
colors etc...) but you can likely left this out of the picture for now...

IMO your beast bet is first to learn about ASP.NET for example at :
http://quickstarts.asp.net/QuickStartv20/aspnet/. Then come back to post
questions on specific points on which you have a problem.

Of course, the very first step would be to make sure what your hoster
supports. If your web site is hosted on a server that doesn't support
ASP.NET, it will be useless (you'll have to choose from dynamic page
technologies that are available on the server on which your web site is
hosted)...

"stevep" <st****@discussions.microsoft.coma écrit dans le message de news:
6F**********************************@microsoft.com...
Im new to web design as you probably can tell. Ive started using
expression
web and this is the way you seem to do it, probably completely wrong mind.

I thought that creating dynamic pages was that you have one main page and
each time you make changes it saves these changes to all the pages in your
site. For example i converted all the htm pages to asp as suggested on
another thread. I had to save each one individually. Would i have to apply
changes i did on one page to each page manually if i were to use asp?

it seems to me that forms can only be done in asp in which case i would
need
all my pages as .asp & the form page as .aspx so the form standard is the
same throughout.

Jul 2 '07 #15

P: n/a
While you can certainly use an "aspx template" and fill it in with data and
then save the file with a specificname.aspx, there is an inherent problem
with this approach that your "lecturer" needs to learn: when you save a file
into an ASP.NET application, because of folder and file monitoring, your
application is going to restart. All session and other data will be trashed.
A Database would be far preferable and more extensible.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder(BETA): http://www.blogmetafinder.com

"fl*******@hotmail.com" wrote:
Hi. I am using visual web developer express edition and I am using
vb.net as the programming language.

I want to create a new aspx file on a button click. I will have a
template that the new aspx file should follow. I need to pass the
values entered on the current page to the new aspx file created. But
more importantly I have problems with the creating of the new aspx
file and saving it. I need all this to be done when i am running the
program. Is this possible? Need to do this for a school project and I
am new to this.

I would appreciate any help on this. Thank you in advance.

Jul 2 '07 #16

P: n/a
Alright. Thank you. I will let him know about this too. Hopefully, he
will stick to using database.

On Jul 2, 11:52 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
While you can certainly use an "aspx template" and fill it in with data and
then save the file with a specificname.aspx, there is an inherent problem
with this approach that your "lecturer" needs to learn: when you save a file
into an ASP.NET application, because of folder and file monitoring, your
application is going to restart. All session and other data will be trashed.
A Database would be far preferable and more extensible.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder(BETA): http://www.blogmetafinder.com

"flip2f...@hotmail.com" wrote:
Hi. I am using visual web developer express edition and I am using
vb.net as the programming language.
I want to create a new aspx file on a button click. I will have a
template that the new aspx file should follow. I need to pass the
values entered on the current page to the new aspx file created. But
more importantly I have problems with the creating of the new aspx
file and saving it. I need all this to be done when i am running the
program. Is this possible? Need to do this for a school project and I
am new to this.
I would appreciate any help on this. Thank you in advance.- Hide quoted text -

- Show quoted text -

Jul 3 '07 #17

This discussion thread is closed

Replies have been disabled for this discussion.