C# - Properly Implement User System For Sessions
Jan 27, 2011
I've never actually implemented a registration/login system before, so I'm trying my hand at making my own in C#/ASP.NET (not using ASP.NET's built-in membership provider). What I'm a little unclear on is how to utilize Session/cookies to keep a user logged in during and between sessions.
protected void Login_User(object sender, EventArgs e)
{
string username = usernameField.Text;
string password = passwordField.Text;
User user = UserRepository.FindUser(username);
if (user != null)
{
if (user.Password.Equals(Hash(password)))
{
// How do I properly login the user and keep track of his session?
}
else
Response.Write("Wrong password!");
}
else
Response.Write("User does not exist!");
}
View 3 Replies
Similar Messages:
Nov 13, 2010
I am developing an application for Online Examination. Once a user logs into the system, he is allowed to start a Test; on clicking start test button the user is redirected to the questions page. Now when the user clicks and confirms ending of the test by a button click then he is redirected to the results page.Now what I want here is that when the results page is being displayed the user should automatically be logged out of the system and should not be able to go back to the previous pages by pressing the browser's back button.
The problem which I am facing right now is that when the results page is displayed anyone can press the back button and continue the test and manipulate the result. How can I stop this.
View 4 Replies
Jan 25, 2010
I'm integrating a number of e-comm sites into different banks and decided the easiest method was to add in the dotnetcharge (www.dotnetcharge.com) library.It works well and means I can keep much of my code the same for each bank type and transaction.However, their support is a bit sucky (4 emails sent, 1 reply) and I'm utterly baffled on the 3D Secure issue.Does anyone have experience with dotnetcharge and 3D Secure?I have set the MerchantURL and the actual 3D Secure screen comes up - but I'm unsure how to get the system to 'flow' properly.Does anyone have any code examples or even pointers in the right direction?Failing that.This particular integration is with SagePay,which also has God-awful documentation and support.
Code for reference is as follows;
[code]...
View 2 Replies
Oct 26, 2010
I have an array object with another nested arrayobject within it. I am binding the outer arrayobject to a gridview and on row data bound event i am refernecing the nested array object and populating a dropdown list in atemplate column of a gridview row. Thgis works fine but when i implement paging and handle the PageChanging event then the data binding of the nested array does not complete properly. See code below. For each page in the gridview the dropdown list is repeatedly populated with the same data
View 6 Replies
Oct 21, 2014
I have a Asp.net web application that is running on 4.51 , When the User login Successfully i return an Object that has info for that user and store this in a Static object. Now my problem is the i
User 1 Login (Welcome James)
and
User 2 Login (WelCome Daniel)
and User 1 refreshes the Page (Welcome Daniel)
My user sessions override each other. i did mess around with the IIS Session before , i just noticed this now.
View 1 Replies
Apr 1, 2011
I have a System.Data.Linq.DataContext object and need to know the proper way of closing it out before it goes out of scope in order to prevent the following error when making a bunch of database changes:
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Can I just call obj.Dispose() or do I need to call obj.Connection.Dispose() or obj.Connection.Close()?
I guess what I want to know is will calling obj.Dispose() end up executing the functionality in obj.Connection.Dispose() and obj.Connection.Close(). The MSDN documentation that I found on these functions does not have this information (at least I didn't see it - I could have mistakenly overlooked it).
View 3 Replies
Jun 19, 2010
I'm trying a lot a things in these days around the Login control. What I want: to keep the user logged ind also when she close the browser. When se returnes to the page, she should be moved to the DestinationPageUrl of the login control.
My Login control:
[Code]....
My Codebehind file for the login control:
[Code]....
My web.cofig settings:
[Code]....
As you can se, I have learned (from google and here in forums.asp.net) that I need to do a FormsAuthentication.SetAuthCookie but I have one problem....... If I do nothing in the page_load the control doesn't keep me logged in through sessions.Is there anyone who can help me, and either explain og link me to a page, where I can see, how I can get the UserName and Password from the FormsAuthentication.SetAuthCookie I maid. I also need to know if when I get UserName and Password from cookies andthen redirect to the /Content/Default.aspx page in page_load the system knows (formsauthentication) the user is logged in?
View 3 Replies
Nov 25, 2010
We're currently deploying code to live pretty reguarly at the moment, but the down side is destroying user session data.
Is there a way of being able to recycle IIS without loosing session data, or is persisiting session state in SQL server or alike the only way?
View 2 Replies
Mar 21, 2010
I am trying to create a system in which there will be a single user accessing his acount from two endpoints simultanously.
I think this is possible.
1) How to restrict the user to have only one session at a time?
2) How to change it to have limited number of sessions per user at a time?
View 5 Replies
Aug 4, 2010
We 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.
View 11 Replies
Jun 17, 2010
I am wondering if it is possible to clear a session variable if the user navigates away from my site.
My example is I have a session storing the logged in user. This is checked for user access to each page.
If the user goes to another site (e.g. google) I want them to relog into the site.
This is to prevent others getting access to a users account if they use the same pc minutes.
I do have a logout that performs this and I know that it is impossible to make users use it! :)
View 2 Replies
Apr 9, 2010
Is there anyway to actually remove all the sessions once the user leaves the site/application or when he/she closes the browser?
View 11 Replies
Feb 9, 2011
In my asp.net MVC 3 web application, I want to implement basic authentication system in my webapp. I have been searching and reading for past two days but still not able to get a hold of it.
I was following [URL]
I created a CustomMembershipProvider class in my models
[Code]....
In my webconfig file, I do have [Code]....
Now, I created a AccountController, in that I added following code
[Code]....
After that I added view fo Logon
[Code]....
Now, the first problem which I am facing is, when I Debug the webapplication, I get HTTP404 error. Url generated
[URL]
But when I try to open
[URL]
View 7 Replies
Oct 21, 2010
I have either an ASP.NET displaying my results, or a Silverlight client. And I'd like to show the current status of my server, or embedded device. (pretend the device reads temperature and humidity stats)
How should I send the status information from my device to the front end? Should I poll the device and save the results to SQL, Azure Table, or the like? (Azure is a technology that fits with this project for other reasons. That's why I mention it) Or should I create a WCF service that polls the device directly and returns the current status.
View 2 Replies
May 29, 2010
im am trying to write a forum using asp.net at the moment i have threads -> topics -> comments i realised that at the moment if users try to go back (from comments to topics and to threads), they can only use the back button in the browsers i am now trying to creat a menu like the one used in this forum (at the top "home >asp.net forums > general asp.net > getting started") as at anytime you can go back to see other topics at the moment i have tried to implement the following :
[Code]....
i thought that if i store get the topic_id from the address bar once, and store it in the session - then when i navigate to ..?comment_id - the topic_id would remain in the seesion i thought that in theory it kind of works, but now that i am trying to explain it here, i know that the session would then = to null. So i wondering is their any way to implement this navigation system
View 3 Replies
Oct 6, 2013
How to implement chat system in our websites, like facebook, gmail. etc ...?
View 1 Replies
Feb 9, 2010
I want to implement Knowledge Management System in SharePoint.
View 1 Replies
Sep 19, 2013
How to show star voting system using ASP.Net, C#.
View 1 Replies
Oct 21, 2010
I am having a lot of the same issue as this poster did with errors on initializing type.
I am trying to learn linq and am about ready to give up - don't get how this is easier...
I'm trying to do a simple update to product names in the product table based on the manufacturer ID
In order to do this I am looping through each record. I was initally successful with changing all names in the column but when I try to query the data, I continually run into multiple problems.
The following poster has had the same issue I have but his solution isn't working for me.
[URL]
I keep getting the same error on the opening bracket on the select statement in the SelectByManufacturerID function...
Error 1 Cannot initialize type 'DataBaseDataManagement.ProductName' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
Button that does the actual updating...
[Code]....
The function that the button calls to get the query... ERROR
[Code]....
The class located in Query.cs...
[Code]....
View 3 Replies
Apr 2, 2014
Iam having registration page where user enter his credentials based on his email i want to send the confirmation link to his mail
View 1 Replies
May 7, 2015
how can i make a simple user comments form using xml. comments entered by the user should be saved in xml.
format of the form:
name: email:comments:
View 1 Replies
Sep 14, 2010
In my Website I have header control (header.ascx) and footer control (footer.ascx).In header.ascx one textbox and one button is there. Textbox meant for accepting search string.
In footer.ascx one textbox and one button is there. Textbox meant for accepting Email-Id.
Now in validation of header.ascx I had done blank checking by JavaScript. And in validation of footer.ascx I had done blank-checking and e-mail checking by javascript.
In both the control the textbox and the button both resides under Panel control whose
DefaultButton property set to the respective button ids. So that if User write write something and press ENTER key from keyboard then it should do whatever respective Button_Clicks will do.
Now My problem is suppose I place the mouse cursor in footer.ascx's textbox and press the ENTER key it validates properly but after that if I place the cursor inheader.ascx's textbox and press the ENTER then it is not working. Again If I do the opposite then also first one will fire but in case of second it is not firing .......
View 4 Replies
Apr 1, 2010
I use asp:Login control, user can login properly, but while checking user Profile information within LoggedIn event of Login control, all of the fields in the Profile objects are empty. Also, User.Identity.IsAuthenticated always returns false. But, all of these issue solved while navigating to another page. Why User.Identity.IsAuthenticated returns false, even user logged-in properly? And, is there any way to get user's profile information within LoggedIn event of Login control?
View 2 Replies
Mar 9, 2011
I have 2 user controls on registered on one aspx page. UserControl1 us having one text box with require field and one submit button.UserControl2 is also having one text box with requirefiled and save button.
Expected o/p is- When I am clicking on any button out of 2(submit or save). Then only related text boxof that user control should be validate. But the error is Both text boxes are validate.
View 1 Replies
Apr 11, 2012
Is there any resource out there , where one can learn how to properly design user interfaces with ASP.NET controls on Visual Studio ?I have tried on my own by adding <asp:Table/> to form and then trying to accomodate panels within <asp:TableCell/> controls but that isn't quite going the way I imagined it would.This may not be the right way to design UIs, but I don't know any better for now.
View 7 Replies