C
Chris
Hi,
I want to create a User Control that shows a registration page on first
visit, or if the visitor has already registered (this session)
shows a list of files for download. I will be using cookies to manage the
registered user's sessions.
In the Page_Load method i check if the cookie exists in Request.Cookies, if
so i Bind the data and show them the available files.
It the cookie does not exist, i want to show the user the form.
My question is this, is there a way programatically to do this using code
behind page? or do i need a big if statement
in my aspx page.
ie can i do something in Page_Load eg
if (!Page.IsPostBack && Request.Cookies["mycookie"] == null) {
// include the form ** how do i include my html form at this point?
} else {
if (Request.Cookies["mycookie"] == null) {
// store the users reg info
// set the users cookie
Response.Cookies.Add(new HttpCookie("mycookie", "testvalue");
}
// bind the appropriate data
}
The alternative i'm trying to avoid is mixing the code with the html,
something like
<html><body>
<%
if (......) {
%>
<form>...</form>
<%
} else {
// cookie setting and data bind code
%>
<%
</html>
</body>
Thanks for any comments
Chris
I want to create a User Control that shows a registration page on first
visit, or if the visitor has already registered (this session)
shows a list of files for download. I will be using cookies to manage the
registered user's sessions.
In the Page_Load method i check if the cookie exists in Request.Cookies, if
so i Bind the data and show them the available files.
It the cookie does not exist, i want to show the user the form.
My question is this, is there a way programatically to do this using code
behind page? or do i need a big if statement
in my aspx page.
ie can i do something in Page_Load eg
if (!Page.IsPostBack && Request.Cookies["mycookie"] == null) {
// include the form ** how do i include my html form at this point?
} else {
if (Request.Cookies["mycookie"] == null) {
// store the users reg info
// set the users cookie
Response.Cookies.Add(new HttpCookie("mycookie", "testvalue");
}
// bind the appropriate data
}
The alternative i'm trying to avoid is mixing the code with the html,
something like
<html><body>
<%
if (......) {
%>
<form>...</form>
<%
} else {
// cookie setting and data bind code
%>
<%
</html>
</body>
Thanks for any comments
Chris