473,670 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1224
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.micro soft.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.N ame is a property solution.
You also can set a session value as User.Identity.N ame, and use this
session value in SQLDataSource. And User.Identity.N ame 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******@onlin e.microsoft.com > wrote in message
news:l6******** ******@TK2MSFTN GXA01.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.N ame is a property solution.
You also can set a session value as User.Identity.N ame, and use this
session value in SQLDataSource. And User.Identity.N ame 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(aspnet db) provided by AspNetSqlMember shipProvider.
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.publi c.dotnet.framew ork.aspnet.secu rity. 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
2407
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 crashed and ever since then its been a problem. Any suggestions. I think it is a setting in IIS. Thanks. ERoessing@pacificdesignstudios.com
10
1175
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
1228
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 message Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
2
1428
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 that contains the SQL Server runs Win 2003 and is the primary controller for our domain. When I connect I receive the error "Login failed for user '(null)'. Reason:
0
976
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 that for certain resources like images created using, excel exports a Windows login prompt appears. Now as a temporary fix, I've created a local user in the server and we give the credentials of this user when the login prompt appears. For Info,
1
6967
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? LoginButton.Attributes.Add("onmouseover", "this.className = 'buttonsmallover'"); LoginButton.Attributes.Add("onmouseout", "this.className = 'buttonsmall'"); -- Jeff Lynch
4
3622
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 possible.. for example..i hav a menu in the parent form named "Administrator" whic has an item "mnuLogIn"..now when i click on login..another child form named "frmLogIn" is displayed..what i want to happen is this: when login form(frmLogIn) is...
2
2031
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 error: - Error Type Provider (0x80004005) Unspecified error /ets/functions.asp, line 20
2
1930
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 database. I have it working with just the username field but I'm confused on how to go about adding another field. I'm pretty new to PHP so don't beat me up too much for this example code, I borrowed and hacked it together in a very short period...
4
6650
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 Visual Studio 2005. Best Regards, Luqman
0
8388
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8907
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8663
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6218
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.