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

Need som quick advice

P: n/a
Hi everyone,

I'm new to C# and I am building website which allows users to fill out
various forms. All is going well, however I'm having a bit of trouble
with one particular issue.

The main page enables users to enter information, and connect to other
pages where they can enter additional details. After entering those
additional details on the other pages, they are redirected back to the
main page. I know I could use Session variables, but thats not very
efficient. I could use Server.Transfer, but that will be a pain since
the flow of the form is a "hub and spokes" topology which could get
messy and complicated.

Essentially what I want to accomplish is to allow the user start at the
main page, click a link and end up on a secondary page where they edit
details. When done editing the details they are redirected to the main
page again, and those details are summarized as well as the fields that
were modified on the main page remain unchange (or rather edit boxes
that were filled are still filled).

I know this can be done by submitting to the database on every redirect
to the sub pages, but I'm trying to speed things up a little and simply
the code.

Any help would be greatly appreciated.

Jun 22 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Youo have several alternatives. You can use Session, which is not as bad as
you seem to think, and could well be the simplest solution to your problem.
If you concerned about memory usage, once you've inserted the data into the
database (in the end), just clear the user's Session of all unnecessary
data.

As you mentioned, you can also use a database to store the data temporarily,
but not only is that a performance issue, but can get quite complex as well
(what to do if the user stops in the middle and surfs elsewhere, for
example).

Another solution is to post the data to the following form. With ASP.Net,
this can be a bit tricky, as it typically redirects or transfers to the next
form, but you can pass the data when you use Server.Transfer, or you can
post it from one form to the next, by putting it into a second hidden form
and posting that. However, again, that can be a bit tricky.

Perhaps Session *is* your best bet!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<en****@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi everyone,

I'm new to C# and I am building website which allows users to fill out
various forms. All is going well, however I'm having a bit of trouble
with one particular issue.

The main page enables users to enter information, and connect to other
pages where they can enter additional details. After entering those
additional details on the other pages, they are redirected back to the
main page. I know I could use Session variables, but thats not very
efficient. I could use Server.Transfer, but that will be a pain since
the flow of the form is a "hub and spokes" topology which could get
messy and complicated.

Essentially what I want to accomplish is to allow the user start at the
main page, click a link and end up on a secondary page where they edit
details. When done editing the details they are redirected to the main
page again, and those details are summarized as well as the fields that
were modified on the main page remain unchange (or rather edit boxes
that were filled are still filled).

I know this can be done by submitting to the database on every redirect
to the sub pages, but I'm trying to speed things up a little and simply
the code.

Any help would be greatly appreciated.

Jun 22 '06 #2

P: n/a
Hi there,

Thanks for the suggestion, maybe Session is my best bet. The next
question is how to do I best use the Session? Can I create a struct
and put it into the Session? And if so, where do I declare the struct
so that it can be accessible on all pages of the web app? Or do I need
to redeclare the struct's structure on every page? (I've tried the
global.asax and since I'm using code-behind, I can't use Includes)

Thanks again,
Nicholas

Kevin Spencer wrote:
Youo have several alternatives. You can use Session, which is not as bad as
you seem to think, and could well be the simplest solution to your problem.
If you concerned about memory usage, once you've inserted the data into the
database (in the end), just clear the user's Session of all unnecessary
data.

As you mentioned, you can also use a database to store the data temporarily,
but not only is that a performance issue, but can get quite complex as well
(what to do if the user stops in the middle and surfs elsewhere, for
example).

Another solution is to post the data to the following form. With ASP.Net,
this can be a bit tricky, as it typically redirects or transfers to the next
form, but you can pass the data when you use Server.Transfer, or you can
post it from one form to the next, by putting it into a second hidden form
and posting that. However, again, that can be a bit tricky.

Perhaps Session *is* your best bet!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<en****@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi everyone,

I'm new to C# and I am building website which allows users to fill out
various forms. All is going well, however I'm having a bit of trouble
with one particular issue.

The main page enables users to enter information, and connect to other
pages where they can enter additional details. After entering those
additional details on the other pages, they are redirected back to the
main page. I know I could use Session variables, but thats not very
efficient. I could use Server.Transfer, but that will be a pain since
the flow of the form is a "hub and spokes" topology which could get
messy and complicated.

Essentially what I want to accomplish is to allow the user start at the
main page, click a link and end up on a secondary page where they edit
details. When done editing the details they are redirected to the main
page again, and those details are summarized as well as the fields that
were modified on the main page remain unchange (or rather edit boxes
that were filled are still filled).

I know this can be done by submitting to the database on every redirect
to the sub pages, but I'm trying to speed things up a little and simply
the code.

Any help would be greatly appreciated.


Jun 22 '06 #3

P: n/a
The Session is global to the application, but specific to the user Session.
You can store anything in it. As long as the class or struct is defined in a
namespace that is available to any given page, it is fine.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<en****@gmail.com> wrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi there,

Thanks for the suggestion, maybe Session is my best bet. The next
question is how to do I best use the Session? Can I create a struct
and put it into the Session? And if so, where do I declare the struct
so that it can be accessible on all pages of the web app? Or do I need
to redeclare the struct's structure on every page? (I've tried the
global.asax and since I'm using code-behind, I can't use Includes)

Thanks again,
Nicholas

Kevin Spencer wrote:
Youo have several alternatives. You can use Session, which is not as bad
as
you seem to think, and could well be the simplest solution to your
problem.
If you concerned about memory usage, once you've inserted the data into
the
database (in the end), just clear the user's Session of all unnecessary
data.

As you mentioned, you can also use a database to store the data
temporarily,
but not only is that a performance issue, but can get quite complex as
well
(what to do if the user stops in the middle and surfs elsewhere, for
example).

Another solution is to post the data to the following form. With ASP.Net,
this can be a bit tricky, as it typically redirects or transfers to the
next
form, but you can pass the data when you use Server.Transfer, or you can
post it from one form to the next, by putting it into a second hidden
form
and posting that. However, again, that can be a bit tricky.

Perhaps Session *is* your best bet!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<en****@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
> Hi everyone,
>
> I'm new to C# and I am building website which allows users to fill out
> various forms. All is going well, however I'm having a bit of trouble
> with one particular issue.
>
> The main page enables users to enter information, and connect to other
> pages where they can enter additional details. After entering those
> additional details on the other pages, they are redirected back to the
> main page. I know I could use Session variables, but thats not very
> efficient. I could use Server.Transfer, but that will be a pain since
> the flow of the form is a "hub and spokes" topology which could get
> messy and complicated.
>
> Essentially what I want to accomplish is to allow the user start at the
> main page, click a link and end up on a secondary page where they edit
> details. When done editing the details they are redirected to the main
> page again, and those details are summarized as well as the fields that
> were modified on the main page remain unchange (or rather edit boxes
> that were filled are still filled).
>
> I know this can be done by submitting to the database on every redirect
> to the sub pages, but I'm trying to speed things up a little and simply
> the code.
>
> Any help would be greatly appreciated.
>

Jun 22 '06 #4

P: n/a
Hi,

The main page enables users to enter information, and connect to other
pages where they can enter additional details. After entering those
additional details on the other pages, they are redirected back to the
main page. I know I could use Session variables, but thats not very
efficient.
Why? you told you that?
I could use Server.Transfer, but that will be a pain since
the flow of the form is a "hub and spokes" topology which could get
messy and complicated.
Agree , I prefer to use Redirect , a Transfer may not be reflected in the
address bar whether a Redirect will
Essentially what I want to accomplish is to allow the user start at the
main page, click a link and end up on a secondary page where they edit
details. When done editing the details they are redirected to the main
page again, and those details are summarized as well as the fields that
were modified on the main page remain unchange (or rather edit boxes
that were filled are still filled).
I would display the summary in a separate page (not the main) and from there
you can have links to each section's page.

I know this can be done by submitting to the database on every redirect
to the sub pages, but I'm trying to speed things up a little and simply
the code.


Again; What is wrong with using Session variables? As a matter of fact I
think you could easily solve your problem using them.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jun 22 '06 #5

P: n/a
en****@gmail.com wrote:
Hi there,

Thanks for the suggestion, maybe Session is my best bet. The next
question is how to do I best use the Session? Can I create a struct
and put it into the Session? And if so, where do I declare the struct
so that it can be accessible on all pages of the web app? Or do I need
to redeclare the struct's structure on every page? (I've tried the
global.asax and since I'm using code-behind, I can't use Includes)
1. You can create the struct either in a separate class library project
and reference that from your website
2. Or you can place the structname.cs file in your app_code directory (2.0)
3. Or as a separate structname.cs file anywhere in your webroot (1.0).

Make sure you only make all classes and structs that will be saved to
the session Serializable, this will prevent problems should you need to
run out of process session state.

Jesse Houwing

Thanks again,
Nicholas

Kevin Spencer wrote:
Youo have several alternatives. You can use Session, which is not as bad as
you seem to think, and could well be the simplest solution to your problem.
If you concerned about memory usage, once you've inserted the data into the
database (in the end), just clear the user's Session of all unnecessary
data.

As you mentioned, you can also use a database to store the data temporarily,
but not only is that a performance issue, but can get quite complex as well
(what to do if the user stops in the middle and surfs elsewhere, for
example).

Another solution is to post the data to the following form. With ASP.Net,
this can be a bit tricky, as it typically redirects or transfers to the next
form, but you can pass the data when you use Server.Transfer, or you can
post it from one form to the next, by putting it into a second hidden form
and posting that. However, again, that can be a bit tricky.

Perhaps Session *is* your best bet!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<en****@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi everyone,

I'm new to C# and I am building website which allows users to fill out
various forms. All is going well, however I'm having a bit of trouble
with one particular issue.

The main page enables users to enter information, and connect to other
pages where they can enter additional details. After entering those
additional details on the other pages, they are redirected back to the
main page. I know I could use Session variables, but thats not very
efficient. I could use Server.Transfer, but that will be a pain since
the flow of the form is a "hub and spokes" topology which could get
messy and complicated.

Essentially what I want to accomplish is to allow the user start at the
main page, click a link and end up on a secondary page where they edit
details. When done editing the details they are redirected to the main
page again, and those details are summarized as well as the fields that
were modified on the main page remain unchange (or rather edit boxes
that were filled are still filled).

I know this can be done by submitting to the database on every redirect
to the sub pages, but I'm trying to speed things up a little and simply
the code.

Any help would be greatly appreciated.

Jun 23 '06 #6

P: n/a
Thanks to all, I've created my structs in a class file in App_Code, and
I'm passing them back and forth with Session variables.

You've all been very helpful.

Thanks,
Nicholas

Jesse Houwing wrote:
en****@gmail.com wrote:
Hi there,

Thanks for the suggestion, maybe Session is my best bet. The next
question is how to do I best use the Session? Can I create a struct
and put it into the Session? And if so, where do I declare the struct
so that it can be accessible on all pages of the web app? Or do I need
to redeclare the struct's structure on every page? (I've tried the
global.asax and since I'm using code-behind, I can't use Includes)


1. You can create the struct either in a separate class library project
and reference that from your website
2. Or you can place the structname.cs file in your app_code directory (2.0)
3. Or as a separate structname.cs file anywhere in your webroot (1.0).

Make sure you only make all classes and structs that will be saved to
the session Serializable, this will prevent problems should you need to
run out of process session state.

Jesse Houwing

Thanks again,
Nicholas

Kevin Spencer wrote:
Youo have several alternatives. You can use Session, which is not as bad as
you seem to think, and could well be the simplest solution to your problem.
If you concerned about memory usage, once you've inserted the data into the
database (in the end), just clear the user's Session of all unnecessary
data.

As you mentioned, you can also use a database to store the data temporarily,
but not only is that a performance issue, but can get quite complex as well
(what to do if the user stops in the middle and surfs elsewhere, for
example).

Another solution is to post the data to the following form. With ASP.Net,
this can be a bit tricky, as it typically redirects or transfers to the next
form, but you can pass the data when you use Server.Transfer, or you can
post it from one form to the next, by putting it into a second hidden form
and posting that. However, again, that can be a bit tricky.

Perhaps Session *is* your best bet!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<en****@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi everyone,

I'm new to C# and I am building website which allows users to fill out
various forms. All is going well, however I'm having a bit of trouble
with one particular issue.

The main page enables users to enter information, and connect to other
pages where they can enter additional details. After entering those
additional details on the other pages, they are redirected back to the
main page. I know I could use Session variables, but thats not very
efficient. I could use Server.Transfer, but that will be a pain since
the flow of the form is a "hub and spokes" topology which could get
messy and complicated.

Essentially what I want to accomplish is to allow the user start at the
main page, click a link and end up on a secondary page where they edit
details. When done editing the details they are redirected to the main
page again, and those details are summarized as well as the fields that
were modified on the main page remain unchange (or rather edit boxes
that were filled are still filled).

I know this can be done by submitting to the database on every redirect
to the sub pages, but I'm trying to speed things up a little and simply
the code.

Any help would be greatly appreciated.


Jun 24 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.