|
-
Sep 27th, 2005, 03:41 PM
#1
Thread Starter
New Member
READONLY based on cookie value...
I am very new to .NET, so forgive my ignorance. 
I am probably approaching this in every wrong direction, but for right now, until i can get a real user authentication scheme going (not to mention having to learn how to use code behind...) this will have to do.
Basically, I have an application that has 3 different user levels. The user shall login and the user/pass verified against an Oracle db. If it comes back good, a cookie is set that specifies the user access level. This app will be used on our intranet, and mostly by people who are not going to mess with cookies, so I am not worried about total security (yet... I just need to get this thing out the door for now, and go back and add aforementioned proper user access later).
Sooo... all that to say that I need to have certain field in a form READONLY depending on the user level captured in the cookie. Here is what I have so far (most of the code removed, only displaying one row...):
VB Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<script language="vb" runat="server">
public sub Page_Load(sender as object, e as eventargs)
MAN_INVOICE_DATE.Text = format(system.datetime.now,"dd-MMM-yy")
CREATION_DATE.Text = format(system.datetime.now, "dd-MMM-yy")
SYS_INVOICE_DATE.Text = format(system.datetime.now, "dd-MMM-yy")
[B]CLIENT_ID.Attributes.Add("onchange","javaScript:this.value = this.value.toUpperCase();")
Dim levelAccess As HttpCookie = Request.Cookies("levelAccess")
Dim userLevel As Byte
userLevel = levelAccess.value
Dim ccmReadOnly as Boolean
Dim dcmReadOnly as Boolean
Select case userLevel
Case 1
ccmReadOnly = "False"
dcmReadOnly = "False"
Case 2
ccmReadOnly = "True"
dcmReadOnly = "False"
Case 3
ccmReadOnly = "True"
dcmReadOnly = "True"
End Select[/B]
end sub
</script>
<html>
<head></head>
<body>
<form method="post" name="form1" runat="server">
<table>
<tr valign="baseline" bgcolor="#99CCFF">
<td align="right" nowrap bgcolor="#99CCFF">CCM Email</td>
<td bgcolor="#99CCFF"><asp:TextBox ID="CCM_EMAIL" TextMode="SingleLine" ReadOnly="<%# response.write(ccmReadOnly) %>" Columns="32" runat="server" />
</td>
<td align="right" nowrap="nowrap">CCM Approval Date</td>
<td><asp:TextBox ID="CCM_DATE" TextMode="SingleLine" ReadOnly="<%# response.write(ccmReadOnly) %>" Columns="8" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>
With or without the quotes around the response.write, I get the following error:
BC30451: Name 'ccmReadOnly' is not declared.
Thanks for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|