How To Get Current Logged In User Name

Oct 25, 2010

I thought this would be a simple task as I am trying to get the current logged in domain user name. I have the following:

[Code]....

but it ALWAYS returns nothing ""

Is there some configuration in the ASP that I have to do first?

View 3 Replies


Similar Messages:

Security :: Link To Current Logged In User?

Jan 25, 2011

I wan't to link to the current logged in user with their userid, this is for the user menu. But I don't see why my code dosen't work.Code Behind:

[Code]....

Masterpage:

<asp:LoginView
ID="LoginView1"
runat="server">
<LoggedInTemplate>
<asp:HyperLink
ID="UserProfil"
Text="Profil"
runat="server">Profil</asp:HyperLink>
</LoggedInTemplate>
</asp:LoginView>

View 3 Replies

Web Forms :: How To Get The Current Logged In User's Email Address

Mar 18, 2010

How to retrieve the current authenticated logged in user's email address who is accessing the page.

I have managed to do it with users. How to get the current authenticated user's email address if that makes sense.

Here is my aspx code:

[Code]....

and my VB script:

[Code]....

Somebody suggested that I should run a query. If you know the user name accessing the page, surely you can take that information, insert it into a query to find out the email address of the user accessing the page. Sounds great but don't have a clue how to do it.

View 2 Replies

Security :: Display Current Logged In User In A Textbox?

Feb 15, 2010

I am trying to make a Contact form exclusive for Members. So as my first field (ID=username) I would like some VB script so that when the page loads it can identify the user that is accessing the page and display it in a read-only text ready for submission by email (with the email address and text area, don't worry about these because I know how to add these).

(here is my Contact us page code, nothing special but I'll give you it just in case)

[Code]....

View 8 Replies

Architecture :: How To Save The Current Location Of Each Logged-in User

Jan 26, 2010

Let me tell you what I need to implement on my company .NET application and I will be more than glad to hear your advise how to do it:

For every user loged-in to the company website, We want to know on which page he is right now. It means, If user X is now on page "1.html", I need to save this information somewhere. If user X after 30-60 seconds going to page "2.html" I want to update it fast where he is now surfing. It means I want to be able to tell at REAL TIME, on each page, Which users are right now observing the page. This is the problem, now I'm looking for the right solution.

If some day my company website will have 400,000 user log-in at the same time, I am going to save to every one of them where he is surfing right now. Maybe I exaggerated, but we do have 45,000 users at the same time on the company web site and the number is growing. I think big so the solution for this problem will be good for a lot of users.

So, my data object for every user should keep this information somewhere:

1. User code (User Number).
2. Which page user is now observing (Page Number).

This object is going to update every 30-60 seconds by using AJAX, so it should be updated fast. It is a lot of reading/writing data. If a user want to see which other users are now on the same page as he his, he will be able to see it, just by going through the whole array of objects.

I don't need this information to be saved in DB, because it doesn't mean anything. It is temporary and changing A LOT. So, I think the right place to do it is using RAM at the the company server, using the Caching Data option. What do you think? Am I wrong?

If I am going to have a data table with lots of records and every record is going to be update every 30-60 seconds. Where should I save all this table data? I am using SQL Server 2008 to save important data as needed, but this data is not important to save, just need to use it for my purpose. Where should I save this data? I think saving it in DB is a bad idea, because of the dynamic update of records every few seconds. I am thinking about 100,000 users who update this table every few seconds. It probably going to kill my DB, so DB is not an option.

What is the right way to implement this kind of thing?

You may think of it like every page is "a chat room" and I want to know who enter now the room (the page), it doesn't have to be completely accurate in time, but approximately.

View 7 Replies

Security :: How To Get Author Of A Post As The Current Logged In User

Jan 17, 2011

The thing is that I'm creating a community fanpage, I have the membership database installed and I have created user profiles for the users, and it works fine. The thing I can't seem to find anywhere is how to capture the current logged on users username and save is as the author of a post in the database. Like right now, I'm writing a post, and when I click Post it will say it's written by Jeanz91 because I'm the user who's logged in. How do I get my site to do that?

View 3 Replies

Web Forms :: Current Logged In User's Information In Sharepoint List?

Oct 8, 2010

in order to prepopulate some user information, i used query to search the sharepoint list. my question is how to search loggin user's info in the list. i used following testing query function. it works fine. however, it can only search specific text, cannot be changed according different user.

[Code]....

View 1 Replies

How To Dynamically Change Session Time For Current Logged User

Oct 27, 2010

it is possible to change dynamically the session time for currently logged user. I'm communicating with a WebService which does a long-running task, and while the it sends the final response, I don't want the user to be logged out.

View 2 Replies

Web Forms :: Authenticate Current Logged In User In Asp 3.5 - Error CS1061

Jan 26, 2010

I want to check that the user trying to log-in is authenticated and it belongs to a certain role. For this I have wrote the following code

protected void btnLoginButton_Click(object sender, EventArgs e)
{
/
if (this.User.Identity.IsAuthenticated && this.User.IsInRole("Admin"))
{
Response.Redirect("~/Admin/Default.aspx");
}
if (this.User.Identity.IsAuthenticated && this.User.IsInRole("Editor"))
{
Response.Redirect("~/Editor/Default.aspx");
}
if (this.User.Identity.IsAuthenticated && this.User.IsInRole("Moderator"))
{
Response.Redirect("~/Moderator/Default.aspx");
}
}

But when I ran this code it gave me this error error CS1061: 'Page' does not contain a definition for 'User' and no extension method 'User' accepting a first argument of type 'Page' could be found (are you missing a using directive or an assembly reference?) I have already added following directives to cs page-

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

Can anybody tell what directie I should add for "this.User" <P.S> My application is web based and it is in ASP.Net 3.5(C#).

View 6 Replies

Web Forms :: Display Online Users Except Current Logged In User In Membership

May 7, 2015

I have below code to display "list of all the online users" inside listBox using Membership function.

Code:

protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
MembershipUserCollection allUser = Membership.GetAllUsers(); // to get all the users
List<MembershipUser> onlineUsers = new List<MembershipUser>(); //creating list of online users
foreach (MembershipUser user in allUser)

[Code] ....

I want to remove that user from the list of online users, who himself has logged in. Example: if I had logged-in with UserName: Admin, then this Admin should not show to me in the list of "online users"

Tried below Code but not working:

protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
MembershipUserCollection allUser = Membership.GetAllUsers(); // to get all the users
List<MembershipUser> onlineUsers = new List<MembershipUser>(); //creating list of online users
MembershipUser m_user = Membership.GetUser(); //to get self logged-in user

[Code] ....

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

Using EWS From Within A Website, Is It Possible To Use The Current Logged In Users Identity?

Feb 20, 2010

I have a web application using Forms authentication provided by AD. I would like to know if it's possible to use EWS to send mail as the currently logged in user without having to supply credentials, or; would I be required to set up an account with impersonating access which will send mail on behalf of the currently logged in user?

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

Architecture :: Show The Current Client Logged In Only What They Have Posted To The Application?

Sep 7, 2010

I am working on an application where it stores information that different clients will be using. I need to figure out how to show the current client logged in only what they have posted to the application and not everything that has been posted to the application. Client 1 logs in and sees what they have posted; client 2 loggs in and sees what they have posted.....etc. Can anyone shed some light on this for me?

View 1 Replies

State Management :: Users Getting Logged Out Because HttpContext.Current Is Null?

Aug 19, 2010

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users. Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies. In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage sessionAs for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was. This seems to work well for us. It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.What's happening is that certain users are being logged out after just a few minutes. We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out. We do not know why the HttpContext.Current is null, and I understand there are many reasons that may occur. What I'm trying to figure out is, is there any way to re-establish the context once it is null? If not, is there anything I can do at this point other than have the user login again? We're also trying to figure out a better way of managing user information (preferences, roles, flags, history, etc), but everything needs context to use, right? Cookies, sessions, cache, etc. all require a response or request, correct? hope this makes sense, because I really need help with this. I've searched the forums here, and found many posts about HttpContext.Current going null, but not a lot of solutions for this...

View 14 Replies

User Controls :: Display User Profile Image Of Logged In User?

May 7, 2015

I would like users to upload a profile picture when they register, and to then show that picture in a picture box control when they are logged in based  on that specific user.

View 1 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

Web Forms :: Account Page Shows Only Information For First Created User, Not The Info On Logged In User?

Mar 4, 2010

I have the membership provider and the create user with tow steps, one of the steps contains a custom registration form, for each created user data will be in the database, and there is an account page shows the data that the new created user did insert during the registration process on the custom registration page,

the problem, when the user is created and logged into his account page, this account page shows only the information for the first created user, not the info on the logged in user , but the logged in user data still saved in database and not showing on his account page?

This is web.confg code:

<?xml version="1.0"?>

View 22 Replies

User Controls :: Disable Or Enable Menu Items Based On Login Type Of Logged In User

Jun 6, 2013

I have table called ROLE with fields (id,name,permission) example values (1001,madhu,hr)

I have another table called LOGIN with fields(id,DOB,password) example values(1001,24101989,madhukumar)

What i want is , if i login using the LOGIN table ,it  check the  id and permission in the ROLE table , if the permission is 'hr' it enable to access the menu , or if the permission is any other it just print the error message ("no permission")

Note: menu is placed in master page , but login is not in the master page ...

View 1 Replies

User Controls :: User Automatically Remains Logged In

May 7, 2015

I've made a membership by create user wizard. everything is good but after click on finish register button, when page redirect to index .aspx, this page thinks tht user logged in. whereas user didnt login just added to DB.here is the code:

protected void CreateUserWizard1_NextButtonClick(object sender, WizardNavigationEventArgs args)
{
try
{
Membership.CreateUser(CreateUserWizard1.UserName, CreateUserWizard1.Password, CreateUserWizard1.Email);
Response.Redirect("index.aspx");

[code]...
 
in index.aspx just have a login name and login status control. tht's it.

View 1 Replies

C# - Change The Logged In User To Another User Temporarily?

Apr 2, 2010

I would like to change the logged in user to another user temporarily to do some process.

For example, say I am logged in as "Joe". In my method, I want to make the logged in user from "Joe" to "SuperUser", do some process, then change the logged in user back to "Joe".

View 3 Replies

Security :: Update Username Of Current Logged Username?

Mar 12, 2010

How to update username of current logged username?

View 10 Replies

How To Know If A User Is Logged In

Aug 20, 2010

is there anyway I could create a function that receives and username and the function returns if the user is currently logged in into the application?

View 2 Replies

How To Validate Whether The User Is Already Logged In Or Not

May 10, 2010

when the user comes to the login page I need to validate whether he is already logged in or not..how I can validate it..can anyone give sample.

View 3 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







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