Multiple page form in asp.net 3.5 - c#

I am trying to design a multiple page web form to collect information from the users. Users can quit at any time and then come back later on the page where they left, I send an email to users containing a link back to their application when they start application process. I am wondering if I can do this with asp:wizard? Does anyone know whether I can use asp:wizard to start from a page where user has left along lets assume 3rd page with their filled data and also when they click back, they should be taken to the prev. page i.e. 2nd page.

I think this is not a good approach. There must be some alternative, that you must try. Nut If this is your requirement, then you might face issues like this
You need to maintain a database of the anonymous users or the users that are using the wizard. Result waste of database sapce.
How would you define that the returning user is the same genuine user , not some bot or hacker. As this might leads make data public. For example you are Akshay , you filled up to wiz#2 and quit. Now next day you want to complete the form. How the system will know u r Akshay Kumar not Sunil Shetty. Also if some Jhonny Lever come and might take a hit and trial on Akshay , then he will get you.
So take a deep thought on the issue and discuss with the seniors regarding the alternatives, also there are lots of SO Guru, which will definitely suggest you some good way out.

I am not using Wizard anymore, but it is possible to go back to any step of the form wizard by using Wizard.MoveTo method. see here

Related

Sync website browsing to another machine?

Is it possible to have a website displayed on two seperate machines but to syncronise the users input on either machine to the other?
Basically any anchor clicks, image zooms, javascript pop out menus etc need to also occur on the other users screen and vice versa.
In my case the site will be developed in c#.NET but how would one approach something like this, would you use javascript or a database or some other method?
Having spent a long time looking into this I've found a solution, SignalR - http://signalr.net/ for ASP.NET allows you to do exactly what I require, I won't go into detail here as the post would become huge but for anyone wanting to do the same in future then visit http://signalr.net/ and have a read, it's amazing technology!

Any simple way of using forms authentification based on user roles?

I want to make a application for customers.
It should contain :
1.Login page
2.Page for simple users
3.Page for administrators
I've found on google a lot of examples but 90% of examples have 20+ pages with some a lot of advanced things and I can't handle reading everything from them.
I just want to make a simple login page , and use 'user role' for the page where user is redirected and 'administrator role' for the page where administrator is redirected.
When I'll finish the page I will public it on a webhosting , and the main problem is that I need user roles,pass,name in a database in asp not on a website .
Is there any easy example to follow ?
Thanks
For a long time I had the same problem - most examples have you create the default schema which has a crazy number of tables.
The simplest example I have found is:
How to: Implement Simple Forms Authentication
It doesn't deal with the persistence layer at all, so it is really simple to adapt as you see fit.

How to display multiple pages under tabs similar to a Browser tab retaining loaded pages

We have an application where we have a single level navigation menu with some heavy-duty pages on each link. The user can switch back and forth between these pages frequently to obtain information that he needs.
Once the page gets generated, it wouldn't change for the session. However, the page is specific to the user, hence we cant cache it.
I was trying to come up with a solution where we generate the page once, and keep it hidden in the background until its link is clicked, but haven't been able to get my head around this.
One of the ways I thought was to have multiple div tags (one for each page) on one page and keep toggling the visibility as the links are pressed, but that would end up making this single page very heavy. Someone also suggested using iFrames, but I am not really comfortable using the iFrames much and I'm not even sure, if it would be any helpful either.
Can you guys please suggest a few approaches to tackle the issue?
update: Just to clarify, we are fine with keeping the pages separate and navigate across using a standard menu bar. We were just looking for ways to optimize the performance as we know that the pages once generated wouldn't change and there should be some way to tap that benefit.
You can use Ajax tab control for this purpose
Try taking a look at this MSDN article which specifically tackles the issue of how to user-level cache. Also, it might be more manageable to break each tab into a user control. That way your ASP.NET page has just the tab control and 1 user control for each section under the tab. It makes managing tabs much easier.
EDIT:
What I would do in your case, since you say the data won't change for the user, is I would grab the static data from the database and then I would store that data in the Session cache. THe session cache is specific per user and you can try to retrieve the static data from there instead of repetitively calling the database.
Check out the ASP Multiview control. Just remember that even though the different views are hidden when not active, their viewstate is still being sent back and forth. Can be a benefit if you need to check control values across views though.

What are the MUSTS for having an asp.Net application to support BACK button of the browser?

Is there any pattern or kind of "least requirements list" to follow for ensuring an asp.NET application to support BACK button of the browser for each aspx page?
thanks
In general, the back button on the browser will take you to the previous HTML GET or POST that occurred. It navigates by page-wide transactions, so anything done dynamically cannot be navigated that way. Also, the back button doesn't rewind code execution, so if you are determining something based off of a Session variable or something similar, that won't be rewound either. Obviously, it won't rewind database transactions either.
In general, if you want to support the back button, you'll need to make sure to divide everything you need to navigate between with said button is divided by an HTML transaction of some sort.
Again, you're going to run into issues if your page display is dependent on server-side control that changes from one post to the next. This is one reason you see some forms feed a 'Page has expired' error when you try to navigate back to them.
Not really... It depends on your application flow.
There are things that make supporting the back button more awkward.
for example using pure ajax to change the majority of the content on the page,
will look like a 'new' page but wont be compatible with the back button (though you can fudge it)
another example is posting back to the same page more than once, as this can make it appear like the back button is not working, and at the same time re-doing your request (and therefore database transactions)
Fundamentally it depends on your application requirements.

ASP.NET security

I'm currently converting our company database application from VB to ASP.NET. This is pretty much my first ASP.NET application, and I had a question about security. I would like some users to have the ability to add or edit data, while other users can only view and print reports. Now, as I understand it, in ASP.NET, I can use form-based authentication to restrict access to certain pages, but what I really would like to do is use the same web page for not only viewing the data, but also editing it (using a grid view). I don't see how I can do that using forms-based authentication without having separate (but similar) web pages in different folders, each with it's own level of security.
I guess I could always use the same web page, then check the users roles to determine if I should enable the 'edit' button or not. Is that a good (and common) programming practice?
Thanks
Checking the role membership is an accepted way of doing it. Do not however just check when you display the button, check during the response to the event it triggers as well, just in case someone tries to bypass event validation.
User.IsInRole() is what you need. As mentioned, check this at each step - users can fake any kind of HTTP response, so every server-side method needs security checks.
Don't just check whether to enable or or not... You must also check it when the edit button is clicked.
I would implement my own custom RoleProvider (MSDN Article). And then have different roles that describe the different access levels on your application, and like blowdart said check when buttons, panels are being diplayed whether the user has access or not to that resource.
Can I recommend using monitoring SQL Profiler (or similar) when you are testing the page if you are using a database? You'll be surprised the amount of calls the db gets for a seemingly trivial page load.
Also, please check security trimmings in ASP.NET. Worth having a look.
Cheers.

Categories