473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ASP login control pre-populate....based on 'attributeMapUsername' inweb.config?

I've got a login control that pre-populates the username using:

TextBox txtUserName = (TextBox)Login1.FindControl("UserName");
string requestor = WindowsIdentity.GetCurrent().Name;
string[] paramsLogin = requestor..Split('\\');
txtUserName.Text = paramsLogin[1].ToString();

I'm wondering if there's an easy way to read the
'attributeMapUsername' setting (if there is one) from the web.config.

IF is set to 'sAMAccountName', remove the domain info.

Trying to make this as idiot proof as possible, since it seems no one
READS the d@mn instructions printed on the screen =P
Nov 19 '08 #1
1 3375
On Nov 19, 9:18*pm, i_robo...@hotmail.com wrote:
I've got a login control that pre-populates the username using:

* * *TextBox txtUserName = (TextBox)Login1.FindControl("UserName");
* * *string requestor = WindowsIdentity.GetCurrent().Name;
* * *string[] paramsLogin = requestor..Split('\\');
* * *txtUserName.Text = paramsLogin[1].ToString();

I'm wondering if there's an easy way to read the
'attributeMapUsername' setting (if there is one) from the web.config.

IF is set to 'sAMAccountName', remove the domain info.

Trying to make this as idiot proof as possible, since it seems no one
READS the d@mn instructions printed on the screen =P
In my web forms (Intranet only) I typically use the
Request.LogonUserIdentity.Name property. It is always in the Domain
\User format. It also contains a couple of other properties such as
IsAuthenticated IsAnonymous as well as properties containing pointers
to their Token etc.
If you are looking for an easy way to read from the web.config look at
System.Configuration.CongiurationManager.It is a static class with 2
read only properties that are collections of connectionstrings and
appsettings there are also other methods for retrieving just about any
part of the web.config you want.
Nov 21 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
0
by: Steve Commisso | last post by:
I'm trying to create a forked login where users of certain roles will be redirected to specific pages. The easy way to do this would be to do the redirecting in the Page_Load() of the default...
7
by: TJoker .NET | last post by:
I'm developing an VB.NET Windows Forms application that uses CR for VS.NET (original version shipped with VS.NET 2002 - my VS.NET has the latest SP installed, no SPs for CR). My reports get their...
14
by: clintonG | last post by:
This is an appeal for peer support sent to Microsoft as will be noted in closing. The Login control does not include a Cancel button. The only option is to convert the Login control to a...
6
by: Tim Cartwright | last post by:
I have a page that has the login control on it, nothing else. This page inherits from a master page, neither page has any code in it. This page works perfectly when running on the WebDev debug web...
1
by: Sean | last post by:
I have a login control which I want to have loaded my demo user name and the demo password. Naturally the demo password doesnt have to show as text literal but best I can tell I cant set the...
2
by: IdleBrain | last post by:
Hello All: I used a Login control to authenticate a user to login. The problem is that when I login with good username & password, the login view would say that the login was successful. But...
4
by: rpapaiof | last post by:
i have designed a login page in this form <?php if ( $_POST && $_POST && $_POST) { $a=file("file.txt"); foreach($a as $k => $v) { $b=trim($v); } #echo "<pre>"; print_r($b); echo "</pre>";...
9
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is...
3
by: =?Utf-8?B?TWlrZQ==?= | last post by:
I have an asp.net 2.0 web application that I have pre-compiled and deployed to a Windows 2003 server. When I try to access the web application I get the following message in my browser: 'The...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.