473,405 Members | 2,210 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,405 software developers and data experts.

Accessing Login info

I have a SQLDataSource I want to tie to the currently logged in user. Is
there any way to use User.Identity().Name as a Parameter in the datasource?
The only way I've got this to work is by creating a label (label1) and
OnInit() setting label1.text = User.Identity().Name. Then I can set the
SQLDataSource parameter to the value of the control, label1.

Thanks,
Ryan
Jun 22 '06 #1
5 1209
Can you use intergated authentication with the SQL server and avoid the need
to pass the username/password in plain text. You would also reduce your user
maintenance on the SQL server by using the domain's role authentication.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
I have a SQLDataSource I want to tie to the currently logged in user.
Is there any way to use User.Identity().Name as a Parameter in the
datasource? The only way I've got this to work is by creating a label
(label1) and OnInit() setting label1.text = User.Identity().Name.
Then I can set the SQLDataSource parameter to the value of the
control, label1.

Jun 22 '06 #2
Jim,

I'm using a SQL Membership and SQL RoleProvider to authenticate the user (VS
2005). These are Internet (not LAN) users so not sure how I would use
integrated authentication. The user is already authenticated by the time
they get to this page I just need some way for my SQLdatasource to know who
the currently logged in user is. The only way I've found to attain the user
information is by using User.Identity().Name. If theres another way I'd be
glad to hear of it.

Thanks,
Ryan

"Jim Wooley" <ji*************@hotmail.com> wrote in message
news:24*************************@msnews.microsoft. com...
Can you use intergated authentication with the SQL server and avoid the
need to pass the username/password in plain text. You would also reduce
your user maintenance on the SQL server by using the domain's role
authentication.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
I have a SQLDataSource I want to tie to the currently logged in user.
Is there any way to use User.Identity().Name as a Parameter in the
datasource? The only way I've got this to work is by creating a label
(label1) and OnInit() setting label1.text = User.Identity().Name.
Then I can set the SQLDataSource parameter to the value of the
control, label1.


Jun 22 '06 #3
Hello Ryan,

To set parameter source for a SQLDataSource, we can select : Cookie,
control, form , session, profile and querystring. So creating a label
(label1) and
OnInit() setting label1.text = User.Identity.Name is a property solution.
You also can set a session value as User.Identity.Name, and use this
session value in SQLDataSource. And User.Identity.Name is just the right
wat to get User Name when you use SQL Membership provider.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 23 '06 #4
Thanks Luke, just what I needed to know.

Since you seem to know a bit about SQL Membership I'll ask you another
question. I'm wanting to customize my membership database because theirs a
lot more information I need to store about the users (address, phone number,
etc). According to this Microsoft article it looks like the User table is
what I want to modify
http://msdn2.microsoft.com/en-us/lib...30(d=ide).aspx. However, I'm
a bit confused as to the purpose of the Membership table which stores what I
would think to be "user information" such as the users email address,
password, etc. Just wondering if I'm going about this the right way (modify
the user table, create a view that contains all user information from both
the user and membership table), and why this info is split into 2 tables.

Thanks,
Ryan

"Luke Zhang [MSFT]" <lu******@online.microsoft.com> wrote in message
news:l6**************@TK2MSFTNGXA01.phx.gbl...
Hello Ryan,

To set parameter source for a SQLDataSource, we can select : Cookie,
control, form , session, profile and querystring. So creating a label
(label1) and
OnInit() setting label1.text = User.Identity.Name is a property solution.
You also can set a session value as User.Identity.Name, and use this
session value in SQLDataSource. And User.Identity.Name is just the right
wat to get User Name when you use SQL Membership provider.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 23 '06 #5
Hello Ryan,

I think it is the right article when we wants to add some customized user
properties like Address, phone.... To implement it, we need to create our
own MembershipUser and Membership provider.

For a customized Membership provider, it may access its own data store, not
the original database(aspnetdb) provided by AspNetSqlMembershipProvider.
Like the Access database in the article
(http://msdn2.microsoft.com/en-us/lib...30(d=ide).aspx.) Therefore,
it is not "split into 2 tables", it is a complete new table in new data
store.

For more questions on asp.net security, you may post in
microsoft.public.dotnet.framework.aspnet.security. I will work with you
there.

Thanks,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 26 '06 #6

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

Similar topics

9
by: Pacific Design Studios | last post by:
I'm running ASP on IIS 5. My users who are on the network can access our database. Any users from the internet "outside" the network can't access it. We don't have a firewall. Our Windows Server...
10
by: Zest4Csharp | last post by:
hello everyone, How can i tell how many instances of a Class have i created with successive uses of the 'new' keyward in C#? cheers Zest
1
by: Paul | last post by:
Hi My web page is accessing a SQL DB to display some data. It works fine using login/password security on the sql server database, but I'm trying to use WIndows authenication and I get the...
2
by: DavidR | last post by:
Hi, My development machine is running Win XP SP2 and IIS. I'm developing an ASP.NET application on this machine that accesses data from a SQL Server database on another machine. That machine...
0
by: Samba | last post by:
Hi, I'm using Forms authentication in my ASP.NET web application. When I deploy this application in a Windows 2000 server machine and access the application .... everything works fine except...
1
by: Jeff Lynch | last post by:
I'd like to add the following attributes to the Login control's Login Button to create a CSS rollover effect. How can I access the control's login button from the page's code-behind? ...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
2
by: geoff.agnew | last post by:
Hi, I'm doing a web based tracking system for exam questions. Using ASP with VBScript to link the database. I have the main log in screen working but when i enter the log in details i get this...
2
by: dylanhughes | last post by:
I'm looking for an example of a login system that has multiple fields (2 to be exact) + password. e.g username, company name and password, the user, company and password are checked against a mysql...
4
by: Luqman | last post by:
How can I Prevent user from accessing any page directly without Login ? User should not be able to by pass the Login screen by typing the Url of any page directly. I am using ASP.Net 2.0 with...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.