Security :: Logged In User's Userid Connect To A Detailsview?

Jan 14, 2010

I have a gridview nested inside a Loggedin Template so when a user logins it will display their own details (name, address etc) When i attempt to run this i get this error message:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[Code]....

View 21 Replies


Similar Messages:

C# - Getting The UserID Of A Logged In User?

Dec 4, 2010

How can I get the exact ID of a user that is logged into a site?

I'm using the login and registration controls created by Visual Studio 2010, in the database the unique identifier is in this 28e8957e-00b8-4e75-bec9-2b90e640962d for example how can I return the exact one to be used in an SQL command for example?

View 1 Replies

Security :: How To Get The Current Logged In UserId Value

Aug 20, 2010

I'm trying to get the current logged in UserId Value, using this code

[code]...

But, I getting an error (NullReferenceException), I did set a url authorization on the page that i try to get the logged in user information, witch is info.aspx, and I made the login.aspx control to be redirected to the info.aspx after the login process, But the info.aspx only shows me (access in denied), how can i make this page knows that i am already logged in?

View 3 Replies

Web Service And Membership - Get UserID Of User When Not Logged In

Jul 21, 2011

I am creating a few web services for use with a mobile application. My current site uses asp .net membership and one of the web services will validate username and password.

In the web service I get passed uname and pword and just use

Code:
If Membership.ValidateUser(username, password) = True Then
Return "True"
Else
Return "false"
End If

Is there a similar way to get the userid without logging the user on or do I need to create a Stored procedure?

View 2 Replies

Forms Authentication - Connect To Database With Logged In Windows User In Intranet Web Application?

Dec 18, 2010

we are migrating existing windows form application to asp.net(3.5) intranet portal, there is a requirement whereby database connection should be made by the logged in windows user. Is it possible to achieve this functionality?

View 1 Replies

Security :: Userid Of Newly Created User / To Store Additional Details Of The User In Another Database Table

Nov 10, 2010

Our application lets the administrator create new users. Since the administrator is logged in, I have set Logincreateduser = false so that the administrator is not logged out even after creating the new user.

The problem is :I need the userid of the newly created user to store additional details of the user in another database table. I see that i can get the username using Createuserwizard1.username; but how do I get the userID?

View 2 Replies

Security :: Get New Created User And UserId Log?

Mar 23, 2011

How to get UserId registered user and log in UserId? My new table tbl_Employees, column:

UserId, UserIdNewRegister
Eg.:
1. Log in UserId is: 76F31C27-9AA4-4968-AEAB-8B5DFEED16E7
2. Register a new user, UserId is: 20T31C27-9AA4-4968-83RR-8B5DFEED1632

How to get UserId: 76F31C27-9AA4-4968-AEAB-8B5DFEED16E7 and UserId new user: 20T31C27-9AA4-4968-83RR-8B5DFEED1632. I want to put the user is stored under UserId 76F31C27-9AA4-4968-AEAB-8B5DFEED16E7 and UserId: 20T31C27-9AA4-4968-83RR-8B5DFEED1632 new user.

LoginCreatedUser is "False" LoginCreatedUser = "False"

View 2 Replies

Security :: To Get UserId Of The Currently Loggedin User

Dec 30, 2010

Is there any way to get the UserId of the curently loggedin user? Please help.

View 5 Replies

Security :: Getting UserId Of Created User?

Nov 9, 2010

The app requires user (mainUser) to login. Once logged in, the user can create users (subUser). I use the CreateUserWizard Control for this. I need to get the UserID of the subUser. HOw can I do this. I'm not sure of how to do it without confusing ASP of which userId I want. Is this a case for sessions? Or is there a more direct way?

View 2 Replies

Security :: User Doesn't Appear To Return Userid

Aug 17, 2010

I'm using membership and roles in a Silverlight Business Application. There is a RegistrationOperation_Completed event in the RegistrationForm.xaml.cs code behind file with:

else if (operation.Value==CreateUserStatus.Success)
{
this.registrationData.CurrentOperation=WebContext.Current.Authentication.Login(, . . .);
. . .
}

where I would like to obtain the UserId that was created for the newly registered user so that I can use it as the key to populate a userdetail table. How do I get it? All I have is the UserName that was used to register the new user.

WebContext.Current.User does not appear to return the UserId.

View 4 Replies

Security :: Getting The UserID Of The Newly Created User

Feb 15, 2011

I have created my own form for creating a new user and collecting data, I just need to do one thing, find the UserID of the newly created user before they have logged in

Here is the Code: [Code]....

How do I get the UserID of the just created user?

View 6 Replies

Security :: Running Application Under The Security Context Of The Logged In User (LDAP Authentication)

Mar 17, 2011

We are using membership provider for LDAP authentication. It is working as it should.

But what all configuration settings I have to do so that
all the future requests to this application run under the security context of the Logged in user account not through the some default user set in IIS.

We need to have this working because all the permissions on the database are based on the logged in user.

We are using form authentication for LDAP authentication. And having impersonation = true in web.config.

View 1 Replies

Web Forms :: Make "UserId" Equal To The "logged-in User" In Vb Code Behind

Aug 25, 2010

I need to insert a declaration in the codebehind function below that will make the variable "UserId" equal to the "logged-in user". In what way do I need to change the code below (elsewhere in the project, I successfully make reference to basically the same code and make the UserId equal to logged-in user by using this handler expression inside an image control: ImageUrl ='<%# Eval("UserId","Image.aspx?UserId={0}")%>'...But in the case below, the function is not fired by this expression, but rather by CustomValidator).

Sub ValidateImage(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
If Request.QueryString("UserId") IsNot Nothing Then
' Get the connection string from Web.config.
Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabaseConnectionString").ToString())
' Create a command object.
Dim cmd As New SqlCommand()
' Assign the connection to the command.
cmd.Connection = conn
' Appendy the parameter to the SqlCommand and set value.
cmd.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value = Guid.Parse(Request.QueryString("UserId"))
' Set the command text
' SQL statement or the name of the stored procedure.
cmd.CommandText = "SELECT Avatar FROM aspnet_Membership WHERE UserId = @UserId AND Avatar IS NOT NULL"
' Set the command type
' CommandType.Text for ordinary SQL statements;
' CommandType.StoredProcedure for stored procedures.
cmd.CommandType = CommandType.Text
' Open the connection.
conn.Open()
' Convert the returned result to a bytes array.
Dim bytes As Byte() = DirectCast(cmd.ExecuteScalar(), Byte())
If bytes IsNot Nothing Then
' Set the HTTP MIME type of the output stream.
Response.ContentType = "image/jpeg"
' Write a string of Binary characters to the HTTP
' output stream.
Response.BinaryWrite(bytes)
' Send all currently buffered output to the client.
Response.End()
Else
args.IsValid = False
End If
End Using
End If
End Sub

View 9 Replies

Security :: Access Denied For Logged User (anonymous User Is Fine)

Jan 7, 2011

I deployed a website where a logged user or an anonymous user can select data and download a XML file. The website generate the XML file in the server and then deliver it.

It works fine in my development environment, but after deployment, the anonymous user can download the file, but the logged user receive this error:

System.UnauthorizedAccessException: Access to the path 'd:HostsLocalUserheringerwebsiteUpload20110107094051.xml' is denied.

It is weird that as anonymous i can do it.

The website server help states this:

"Grant write, modify, delete access rights on website's folder

Your website executes under unique user account that by default has full control over the website's folder.
So your application can create, open, read, write and delete files and folders inside of your root folder.

There is no need and no way to change this permissions.

If, when running ASP.Net application, you still unable to create file or update it, you have to check your Web.Config file for "<Identity impersonate..." tag and remove it.

The only exception is when the application tries to modify a file or folder in "Application_Start" event of Global.asax file. This is by design that user authenticated only after the Application_Start even. Before the user is authenticated your website runs under an identity of Application Pool which is "Network services". That account doesn't have access to the folder of your website.

To make it work you eather have to move the code that tries to modify files or folders out of the "Application_Start" event of the Global.asax file or inside the event you'll need to impersonate your user by code."

But i am not using impersonate and the tag is not in my web.config.

View 2 Replies

Security :: Log Out User When Logged In Somewhere Else?

Sep 1, 2010

Our users are only only allowed to log into our site from one location at a time. If they attempt to login from a second location, how do I log them out of the first location?

View 1 Replies

How To Get Current Logged In UserID In Aspnet Mvc Membership

May 7, 2010

i am trying to show a list of users of my application "school", when admin logs in then he can view all the users in list but when school principals logins, he should get only users of his school, So i thought to get the current loggedIn userId first and then by that userId i'll get schoolId since userId is foreign key in school table...once i'll get the schoolId i can show the members of that school.

But my problem is how to get the UserID of currently loggedIn. I'm using MVC 1.0 Asp.Net -- "Membership" if my logic above is wrong then tell me the alternate good idea, so that principal can see only his users list.

View 3 Replies

Web Forms :: Matching Logged In Userid To ID In Another Table?

Feb 2, 2011

So I have been trying to pull the userid of whoever is currently logged in and match it to another table that it is a fk in. I have some code that should work but I get an error that says specified cast is not valid in line 10.

here is the code I have behind file:

[Code]....

View 4 Replies

Security :: User Being Logged Out Straight Away?

Jun 9, 2010

I have been creating a website using the SQLMembershipProvider. I have been using an administration account to create the back-end system for generating the users fine for about 2 weeks. I now have more users created and I can log in fine. However, when I log in as the newly created users, they can get to the page they are after, but if they refresh the page or redirect to another page, they get redirected to the login page. I have checked permissions, iis recycler, session state and security setting in my web.config (posted below) but nothing has fixed it. It cannot be IIS because it does it on my development machine as well as on the actual webserver and it works fine for the admin user.

Ttype="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
[code]...

View 4 Replies

Security :: How To Sign In As Another User While Already Logged In

May 30, 2010

I have used membership provider to implement my system. The system administrator can list the users. What I want to do is, administrator should be able to sign-in as the selected user. I can sign out administrator by FormsAuthentication.Signout but how can I sign in as the selected user? Passwords are hashed so I can not retrieve the passwords.

View 3 Replies

Security :: How Does Each Page Get The User That Is Logged In

May 21, 2010

I've successfully made a custom membership provider that connects, queries, and updates my custom Oracle database. I found a good sample on MSDN. I also found documentatio on the provider itself. However, I cannot find anywhere example calls you have to make for the different actions within the web pages themselves. Where can I find that?

For example

How do I check if a user is already logged in? What do I do when a user hits the login button? How does each page get the user that is logged in? etc.I am not using the asp login control. I have custom form, custom data, and custom graphics.

View 3 Replies

Security :: Getting Logged In Domain User

Apr 5, 2010

All I'm trying to do is pull the current user's login name from Active Directory. I've tried User.Identity.Name.ToString, which returned nothing at all. I tried Environment.UserName.ToString, Which returned "NETWORK SERVICE" which is not the firstname.lastname username that I was expecting.

View 3 Replies

Security :: Check User Is Logged In Or Not?

Apr 14, 2010

I have one application for collection centres in the city in which ADMIN will have access to all pages in it.In which I have added functionality for admin to see Online users/offline users collection and there collection center name.How can i see the users online automatically when they will be logged in on application.Like we all see in google talk, yahoo messanger, etc like that onlyI also want to keep the option like whether to view only online user or offline users etc.I have tried the following code for getting the Ip address for the computer..But I am unable find how user should be shown as active

ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR") ;
if (!string.IsNullOrEmpty(ip))
{

[code]...

View 8 Replies

Security :: Delete User Who Is Logged In?

Jul 19, 2010

If a user who is logged in wants to delete his own account, why does login status still show him loggedIn even when user has been actually deleted.What I want is when user deletes his account he should get logged out also at the same time ....How do i log him out ?

[Code]....

Line 25: Call deleteSelectedUser()Line 26: Line 27: If User.Identity.Name = LstBoxUserList.SelectedItem.Text ThenLine 28: FormsAuthentication.SignOut()Line 29: Call deleteSelectedUser()

View 5 Replies

Security :: Logged In User Data?

Aug 21, 2010

I'm using the defualt membership provider, i created a table and used the gridview on the logged in user page to show his information such as address e-mail phone zip code etc,, how can i do this without writing a code?

View 6 Replies

Security :: Display Logged In User Details

Jan 13, 2010

i have a login form where it validates 'username' and 'password' against a datbase table. After a user logs in, i would like to show their details such as image, name, etc in a detailsview.

View 16 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved