Help! How to create aspx file dynamically

F

flip2flik

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.
 
P

Patrice

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).
 
F

flip2flik

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.
 
M

Mark Rae

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
 
P

Patrice

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).
 
F

flip2flik

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.
 
M

Mark Rae

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...?
 
F

flip2flik

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. =)
 
M

Mark Rae

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... ;-)
 
G

Guest

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
 
M

Mark Rae

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...
 
G

Guest

I think i am having the same problem.

I have created a dynamic website with html pages and on one of these pages i
would like to have a contact form; with name, address & email etc. This page
has to be done as an aspx page. Ive saved the dynamic pages & tested. It
displays the site headers etc with the form titles but not the boxes or send
button.

I would have thought having a contact form is a common request but I havent
seen any asp.net code for this only v2 which the isp doesnt support

Any ideas? Thanks
 
M

Mark Rae

I think i am having the same problem.

I have created a dynamic website with html pages and on one of these pages
i
would like to have a contact form; with name, address & email etc. This
page
has to be done as an aspx page. Ive saved the dynamic pages & tested. It
displays the site headers etc with the form titles but not the boxes or
send
button.

I would have thought having a contact form is a common request but I
havent
seen any asp.net code for this only v2 which the isp doesnt support

Any ideas? Thanks

I've already replied to your first post about this asking for more
information about what you're actually doing - there's no need to post the
same thing more than once...

Firstly, can you please clarify what you (think you) mean by "dynamic
website"? Are you using ASP.NET or not...?
I would have thought having a contact form is a common request

It certainly is. It might be easier if you actually post your "dynamic page"
for the newsgroup to have a look at...
I havent seen any asp.net code for this only v2 which the isp doesnt
support

Again, please clarifiy what you mean here. Are you saying that your ISP
doesn't support ASP.NET, or doesn't support ASP.NET v2?
 
G

Guest

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.
 
G

Guest

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
 
M

Mark Rae

Im new to web design as you probably can tell.

Nothing wrong with being a newbie - we were all newbies once... :)
Ive started using expression web and this is the way you seem to do
it, probably completely wrong mind.

Hmm - OK... I've never really looked at Expression Web, but you might get a
lot better help in the correct newsgroup:
microsoft.public.expression.webdesigner
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.

Oh dear me no! Active websites (i.e. those created with ASP / ASP.NET and
other similar technologies) use pre-designed pages (e.g. aspx) which the
server uses to create dynamic HTML which is then streamed to the browser -
the actual aspx pages themselves are not updated each time.

You might use the analogy of a Word template. The template is used to create
a new document to display to the user based (maybe) on some user input at
creation time - but the underlying template itself is not changed by this
process...
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.

Forms can be done perfectly simply without ASP / ASP.NET - websites have
been around for a lot longer than Active Server Pages... :)

I would suggest that you post in the Expression newsgroup I suggested above
and see if they can give you some more relevant assistance.

Alternatively, if you decide that ASP.NET really is where you want to be,
then I suggest you get a hold of this:
http://www.amazon.com/ASP-NET-Every...9790054?ie=UTF8&s=books&qid=1183379045&sr=8-3
and read all the way through it.

Then, download this: http://msdn.microsoft.com/vstudio/express/vwd/ It's
free, and is aimed specifically at new web developers.
 
M

Mark Rae

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...
 
P

Patrice

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)...
 
G

Guest

also new to here so fab responses thanks guys!

ps. really came to the MS discussions to find out why the 2003 server
appliance edition wont install the R2 VLK....any ideas... ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top