Total Beginner Question.

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>
 
E

Evertjan.

=?Utf-8?B?SU5UUDU2?= wrote on 03 feb 2009 in
microsoft.public.inetserver.asp.general:
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 va

This is a classic asp group.

Dotnet questions should be asked in
<microsoft.public.dotnet.framework.aspnet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top