I
INTP56
I have a need to get the current logged on user and pass that value on to a
database. WHile ASP:LoginName displays the right value, I can't seem to
figure out how to use that value anywhere else. I've included some very basic
code, and I'm wondering if someone can show me how to get the login name into
a text box. I have figured out how to use a value in a textbox as a parameter
(If I just set it to a valid value).
TIA, Bob
Here is some code I've tried.
<%@ Page Language="C#" %>
<html dir="ltr">
<head runat="server">
<META name="WebPartPageExpansion" content="full">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled 1</title>
</head>
<body>
<form id="form1" runat="server">
LoginControl:
<asp:LoginName
runat="server"
id="LoginName1"/>
<br>
<br>
TextBox:
<asp:TextBox
runat="server"
id="TextBox1"
text="What do I put here to get the value of LoginName1?"
Width="378px">
</asp:TextBox>
<br>
TestBox1:
<asp:TextBox
runat="server"
id="TestBox1"
text=Request.ServerVariables("LOGON_USER")
Width="378px">
</asp:TextBox>
<br>
TestBox2:
<asp:TextBox
runat="server"
id="TestBox2"
text=User.Identity.Name
Width="378px">
</asp:TextBox>
<br>
TestBox3:
<asp:TextBox
runat="server"
id="TestBox3"
text=HttpContext.Current.User.Identity.Name
Width="378px">
</asp:TextBox>
<br>
TestBox4:
<asp:TextBox
runat="server"
id="TestBox4"
text='<%Session("Username")%>'
Width="378px">
</asp:TextBox>
<br>
</form>
</body>
</html>
database. WHile ASP:LoginName displays the right value, I can't seem to
figure out how to use that value anywhere else. I've included some very basic
code, and I'm wondering if someone can show me how to get the login name into
a text box. I have figured out how to use a value in a textbox as a parameter
(If I just set it to a valid value).
TIA, Bob
Here is some code I've tried.
<%@ Page Language="C#" %>
<html dir="ltr">
<head runat="server">
<META name="WebPartPageExpansion" content="full">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled 1</title>
</head>
<body>
<form id="form1" runat="server">
LoginControl:
<asp:LoginName
runat="server"
id="LoginName1"/>
<br>
<br>
TextBox:
<asp:TextBox
runat="server"
id="TextBox1"
text="What do I put here to get the value of LoginName1?"
Width="378px">
</asp:TextBox>
<br>
TestBox1:
<asp:TextBox
runat="server"
id="TestBox1"
text=Request.ServerVariables("LOGON_USER")
Width="378px">
</asp:TextBox>
<br>
TestBox2:
<asp:TextBox
runat="server"
id="TestBox2"
text=User.Identity.Name
Width="378px">
</asp:TextBox>
<br>
TestBox3:
<asp:TextBox
runat="server"
id="TestBox3"
text=HttpContext.Current.User.Identity.Name
Width="378px">
</asp:TextBox>
<br>
TestBox4:
<asp:TextBox
runat="server"
id="TestBox4"
text='<%Session("Username")%>'
Width="378px">
</asp:TextBox>
<br>
</form>
</body>
</html>