tags:

views:

425

answers:

2

Hey guys, i have to create an asp.net page dynamically on runtime.

It should work like this:

1) User logs in using <authentication mode="Windows" />
2) A CheckUser(string Username){} will be send to the webservice which connects to a MySQL database and response with true or false.
3) if the checkuser was true the webservice will check in which roles the user is.
4) depending on the roles an aspx page should be dynamically created with different controls and with different content

what's the best way to do it? im working with .NET 2.0

+4  A: 

Build static pages with dynamic content, rather creating whole pages dynamically out of thin air. Then have the server redirect to the correct page. Use your web.config file to enforce the security.

Joel Coehoorn
Very Easy to add additional pages for newly introduced roles this way too
Russ Cam
well.. there are too many different combinations.. some people can be in up to 5 different roles.. which makes the page looks different... so i have to build too many different static pages..
darkdog
That's kind of the point of having server-side code: so the pages can adjust themselves to suit. But you still want a real file or 3 there as an anchor.
Joel Coehoorn
Agree completely with Joel.You can have a single page if you want, and just display the controls you want to based on the roles. No need to dynamically generate an aspx file. Have an aspx file there which generates the controls when accessed.
Sam Meldrum
edited for clarity
Joel Coehoorn
A: 

Create a single aspx page and then when that page is being rendered, check the permissions and turn on/off content as needed. You can build functions on your page as user controls and dynamically load user controls on your page based on those permissions if you want, or you can put content in panels and just show/hide panels as needed. But do this by creating an aspx page as the base like is mentioned above.

Scott