Security :: Find If User Logs In For First Time In C#?
Mar 22, 2011I need to show the user a different page when he loggs in for first time alone..
How can i do this..
I need to show the user a different page when he loggs in for first time alone..
How can i do this..
if user login first time in application in how i promot for change password in Asp.Net C#.
View 1 RepliesWe have take over a classic asp site. Everything works fine, but we are making improvements to some reports and adding new reports, so we are doing this in .NET, with that said, after reviewing the secuirty code, there are 2 sessions that are set and used thru-out the site as part of some of the individual page queries.
I know that the sessions are being populated, because the reports that use those values return records.. now with a new report we are working on, i need to pass those values into my query. But when i try using the session names the page is coming up saying the following:Object reference not set to an instance of an object.
Is there anyway to add something to my page code to see what sessions are actually being created and their values.. maybe im using the wrong variable names.. but the security code is pretty straight forward.. at login, if successful, 2 values are returned and stored in 2 sessions.. i need to use those with my new page.. so trying to figure out why the existing pages work fine with that and my new page does not..
Basically, i'd like to write to the screen the session variables that are being created on the login page.
i use formsauthentication for login. but i wanna register user logs logs table. i can access username page.user.identity.name, but how can use userid?
View 4 Repliesi'm using ASP.NET membership for a silverlight application that makes use of Wcf Ria Services.
my problem is that i don't want multiple logins on the same account and i need to logout the user when he logs in on another machine. (I don't want the account to be used by many people at the same time, and the last who logs in must kick out everyone else)
I want to log out the user when he (or someone else) logs in from a diferent computer using the same user name.
Basicaly i want to prevent multiple individuals from staying loged in under a single user name by signing out the previous users. Any ideeas about how i can acomplish that ?
i am using membership to create an account page that a user enters after logging on.
In the page load of "MyAccountPage.aspx" I have the following which gets the userid and add it as a paremeter
Guid userid = (Guid)Membership.GetUser().ProviderUserKey;"ClientId"].DefaultValue
= userid.ToString();
ObjectDataSource7.SelectParameters[
"ClientId"].DefaultValue = userid.ToString();
This works fine - I have now added to the page a LoginStatus as when they arrive they are loggen in. The problem is when the user clicks the Logg off link I get the error on the page below -
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
[Code]....
Is this because the page load is trying to get the logged on user ID
but they have just logged out?
How can I allow the User to logg out without getting the error?
I've been trying to work out this error for a while now and i still dont understand it because i have been following a tutorial online step-by-step but i recieve this error when i log in ?
What i am trying to acheive is when the user logs in then they are able to view their 'profile' such as their name, address etc. The login is validated against a table in a database, ...this is the error i am recieving:
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
[Code]....
I need to display a javascript confirm box after the user successfully logs into the application. If the select 'yes' of the confirm box then I need to navigate them to a different page and if they select 'no' the default.aspx page should be displayed. I am using the login control.
I tried to use ClientScript. RegisterClientScriptBlock on Login1_Authenticate event, it didn't work. I tried the same thing on the Page_Load event of Default.aspx as well as Master Page load event, that also didnt work.
This is what I have in the RegisterUser.aspx and yet when the admin registers a new user, then on clickiing the register button, the site logs in as the user who was just created.
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
Roles.AddUserToRole((sender as CreateUserWizard).UserName, "Department");
}
Nowadays having activity logs of the system is needed for history and if someone who is trying to mess your site, it is easily to define who is it and when it happen. And even Facebook have it.
View 1 Replieshow to add notification facility same as facebook in our c# website, clients get the notification on their profile whenever any new feature is aaded to website..?
View 1 Replieshow to maintain the session that doesn't expire unless and until user logout.
View 1 Repliesweb.config
[Code]....
i am allowing only tht particular users.In my code how to find out the current user type.And wht is the difference between
[Code]....
For some reason I couldn't find it anywhere, how do I find the current user's role in vb.net?
View 3 RepliesI have only username. and want to check and grab the password from the database. It is BEFORE LOGGING IN. so I don't think the build-in asp.net functions could be used, right?
View 5 RepliesI'm going to add my own user control LoginBox to my MasterPage.
I want to just refresh the page the user is currently on when he logs in to the system. How can I accomplish this?
I have a bug in which, whenever an error occurs the user seems to get logged out. After much research I find that the situation is not so simple:
(note I have dumbed these down a bit to make it easier to follow)
Web.config - I turn on Custom Error Mode
I was wondering when a user logs in using the login control for ASP.NET, how do we choose where the user goes after? Do we configure this in the web.config file?
View 2 RepliesI am working on an application to read event logs on a remote machine. I tried adding this to the web.config
<identity impersonate="true" user="domainuser" password="password" />
However, when I ran this, I got the following error:
Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.
I looked at this post
[URL]
It seemed to suggest I would need to create a new account on the remote server. Is there a way I can just use an existing domain account?
i am creating a c# website with three roles
admin, students & professors
i want to add users to student role every time people register on my site..
then admin will control the users but how to add users to a Student role at register button's click event?
I am developing a Login Screen and I want to Print the name of User at the page who have login last in all users (just like Hotmail).I dont know how to do it.
View 1 RepliesI need to do something when the user logs out. I have used ASP.NET Forms Authentication.
What should I override or implement?
I have an ASP.NET login control and I want to empty the basket-viewer when the customer logs out of the system.
I have an web application which requires login. When users finish their activities they simply logout. What I need is to clear browser history when user click logout button. This should disable BACK button in browser.
View 1 RepliesBelow code is working fine, it will logout user in after 1 minute, since I have another login control in Home page, I was trying to add another line:
<forms loginUrl="Default.aspx" timeout="1"/>, but gives me error: The element <forms> may only appear once in this section,
so the timeout in the webconfig can only have one page for the function?
[Code]....