views:

20

answers:

1

I want to be able to load a customized log in page depending on a couple of parameters passed into the querystring.

Each customized login page needs to be able to dynamically display log in errors and possibly have other variables passed in. Let's say the dynamic login page looks like this (over-simplification here):

<form>
<% if (has_errors) { Response.Write(error_msg); } %>
<input type="text" name="email">
</form>

If the aspx page loads the file like this:

Response.writefile("path/to/custom/page"); 

the code shows up in the output and doesn't get processed. I have tried other ways to load the file contents (something similar to classic ASP includes) but get the same results every time.

I could have all the custom pages set up as user controls, but I need 100% control over the css, js, and html - and the documentation I read here indicates that I won't have that level of granularity. link text

PLUS - I'm stuck in a .net 2.0 environment - so .NET MVC is not available to me

Any help/suggestions?

+2  A: 

but I need 100% control over the css, js, and html

You won't get 100% over the page but you will have control inside the User Control instance. Also, many times, you can override these technologies like CSS, from within your control.
In the end because all controls are solified into one big HTML page you will have the same level of control as you would in any single web page with client-side technologies.


You can build a Web UserControl to represent log/in and then include an instance of that control onto any page, in any place, across multiple pages if you wish.
(See the Topics on that MSDN help page about how to create and use it).

Other useful references (these are various angles on the same subject).

This should provide a good start to keep looking, if this is the kind of info you think you need.

Internals
The User Control can have its own logic, access the browser querystring, access the page Session, Application, etc. pretty much anything it needs to know for itself to work.

Object Oriented
Additionally, because a User Control is also an object, you can add your own public methods and properties to it through which you can interact to communicate with the control intance on the page (just like you interact with other web controls like Button.Text="click", TextBox.BackColor = System.Drawing.Color.Blue, etc).

Other Options - Dynamic control loading

You might want to consider loading controls dynamically at runtime using the Page.LoadControl(..) method:

Loads a Control object from a file based on a specified virtual path.

MyControl myControl1 = (MyControl)LoadControl("TempControl_Samples1.cs.ascx");
PlaceHolder1.Controls.Add(myControl1);
John K
I guess I was hoping for something more MVC-like; but I'm thinking that being stuck with .NET 2 is dashing that hope across the rocks. Can the ascx page(s) be put into a folder without being compiled first?
JayTee