.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

Prevent Concurrent Logins ? [ Already logged in or currest session is still active implementation] ?

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

Hi Experts ,

I searched over the web but no luck so far and thought of getting some help form gurus .

Did any out really implemented a way to handle concurrent logins ?

Please not that i'm no using either forms authentication or Roles/Memberships , I do have custom authentication for my website .

I'm sure it is someway related  with global.asax file handling something in application events and session events but unable to figure this one out .

Any pointers will highly be valued and appreciated .

Thanks a tonne in advance .

View Complete Post

More Related Resource Links

How to prevent closing session when remote desktop is closed or we logged of?



It's known when we execute Coded UI tests on physical remote desktop computer and its window is minimized, closed or we logged off the tests fail. The reason is the session should be active to do all the UI actions.

I'm just wondering if it's possible to prevent closing session directly from the code? I mean could we write some code from our Coded UI tests that would prevent closing session?

Can we use any other way to workaround this? For example, executing tests from command line using tcm.exe.

Thank you in advance.


if logged in user is not active for 20 mins I want a message box to tell them they are logged out ?

 hi, i am using membership on my site If a user is not active then after 2o minutes they click a button an exception is raised and it goes to a red error page which does not look good. Instead I want to re-direct them to login page with a message saying you have been logged out.   thanks for any solutions   P

Problem in display Full Name after logged in (Session Problem)


After login, i have create a session to display the Username of the logged user, however instead of display the Username, i want to display the Full_Name of the logged user

However i have no idea how it dones....Kindly if you could help me in giving suggestion / ideas. Thank you.

PersonUser Table

P_ID (PK)   =1

Username =lucy88

Password =88ycul

Full_Name = Lucy

User_Type =Admin

Login.aspx - as i do session, it will display lucy88 however i would like to display Full_Name which is Lucy.


    protected void Button1_Click(object sender, EventArgs e)
        SqlDataSource sds = new SqlDataSource();
        sds.ConnectionString = ConfigurationManager.ConnectionStrings["MyDB"].ToString();
        sds.SelectParameters.Add("Username", TypeCode.String, this.TextBox1.Text);
        sds.SelectParameters.Add("Password", TypeCode.String, this.TextBox2.Text);

        sds.SelectCommand = " SELECT * FROM [PersonUser] WHERE [Username] = @Username AND [Password] = @Password";
        DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        if (dv.Count

how to prevent session timeout during files uploading (postBack free uploader).


Hi All,
         i am using a multi selecting file upload control which is postBack free.
I am using session timeout.
 My problem is that during files uploading my session got expired. Bcoz my uploader
not being postback so i can't enhance session timeout. and while uploading my session
got expired and process was not completed, causes some imp files could not uploaded.

 any one suggest me what to do OR any idea to complete uploading then session timeout.

Random Occurance of 'The transaction active in this session has been committed or aborted by anothe


I am executing calls to 3 Stored procedure in TransactionScope

On a random basis i get the following error:

    'The transaction active in this session has been committed or aborted by another session.'

On Executing the SPs again with the same data i am not able to reproduce the error.

Any suggestions on What i should investigate.


Can I prevent deadlock during concurrent delete


Hi All,

  For some irrelevant reasons I need to delete a bunch of records by column value without saving these columns to a database. The list is huge so I run several delete operators concurrently. Recently I experienced a deadlock and I wonder what are the possible reasons and a reliable way to prevent it? If I drop clustered index first (I drop it anyway to speed Bulk Insert up) will it help?

   I have only seen this once so there're no reliable reproduction conditions to capture additional info.

   So to summarize, I'm using SQL Server 2005. I have a table with clustered index and I concurrently issue a bunch of DELETE operators in form

DELETE from MyTable

where MyColumn in (Val1, Val2, ... ValN)

and the exception was

System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 58) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObjec

Active users session per companyID.


I have a table as "Company".

each companyID may have many number of active logged in users.

I want to keep a count of active User Sessions, per companyID!

so how can i keep track that how many active users sessions are there as logged in into the application.

Please suggest me its very important.

Note: I Have each users Session("CompanyID"] , Session["UserID"].


Prevent Session.Timeout extension on certain event



How to prevent Session.Timeout extension on certain event from codebehind?

What I do - I have Session Timeout configured in Web.config file for 10 minutes. Also, I have in my webpage1.aspx, an ASP.NET AJAX control ModalPopup which shows into the page 9 minutes after the user stopped sending requests to webpage1.aspx. I did this with this code:


                <asp:Timer ID="Timer1" runat="server" Interval="540000" ontick="Timer1_Tick">


        protected void Timer1_Tick(object sender, EventArgs e)
            showModalPopupServerOperatorButton_Click(null, null);
            Timer1.Enabled = false;

So, my initial calculations was that 1 minute before the session ends, i'll inform the user something with the ModalPopup. The problem is that when this Timer1_Tick event triggers, the session.timeout renew ( or extends ) and the session ends 10 minutes later (if user still don't send any request from his browser).

Can I write code in Timer1_Tick event which prevent session extension?

User-friendly way to prevent concurrent form editing (browser-enabled IPath forms)


I have a single InfoPath form with a lot of information that multiple users will need to access to read and some of them will also need to update. I'm struggling to find a user-friendly way to avoid concurrent editing of the form. I find that the "require check-out" option is very badly integrated with Form Services.

Indeed, if the user forgets to check out, he can open the form and make all his changes and it's only when he clicks on "save" that the form tells him that he needs to check-out before editing (in my case, the user shouldn't save as another file). On the other hand, if a user checks out the form and save his changes, no prompt suggests him to check in his form so there is a big risk that the user may prevent for a long time the others to update the form.

It's strange that InfoPath 2007 doesn't have the ease of use that Word 2007 has with checking out, namely the prompt to check out a document once clicked and the prompt to check in the document once closed.

Any idea for this problem?

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

jQuery Date picker Implementation in ASP.NET

I've posted a wrapper ASP.NET around the jQuery.UI Datepickercontrol. This small client side calendar control is compact, looks nice and is very easy to use and I've added it some time back to my control library.

This is primarily an update for the jQuery.ui version, and so I spend a few hours or so cleaning it up which wasn't as easy as it could have been since the API has changed quite drastically from Marc's original implementation. The biggest changes have to do with the theming integration and the resulting explosion of related resources.

If you want to use this component you can check it out a sample and the code here:

logged in user data


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?

I am new to asp.net  i need simple help please?

Automatically redirect to HTTPS and check if SSL is active



I've set in the web.config:

    <!-- User Authentication -->
    <authentication mode="Forms">
      <forms loginUrl="~/Page/View/Content/Login.aspx" timeout="2880" requireSSL="true" />

This works fine. If there is no ssl connection, the login form doesn't continue. But I would like to check if ssl is active (in codebehind) and, if it's possible, to automatically the user to the https page if he's currently on http. (I could do this job by manually redirect with page.response("https://url.../login.aspx"); but this is not really generic. For example if the webapp is moved to another domain it doesn't work anymore... I'm looking for something like: FormsAuthentication.RedirectWithSSL(); or so... :D)


SQL Server Session state problem.


Hi to all,

I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.

Session and Application Variables


I have a web application in which i need to logout the user if he clicks the logout button or even if he closes his browser window. On Logout button click, i am doing session.Abandon(), but how to go about his browser window close.

Can anybody help with a code sample.

Is there any way to find out the reason for session expiry?


Dear All,

is there any way to find out the reason for session expiry?



Session time out earlyer with in 5 min.


In my live site session time out with in 5 min only.how can i get the default i.e 20 min time . below webconfig file give below

<?xml version="1.0"?>
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, &#xA;        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, &#xA;        PublicKeyToken=31bf3856ad364e35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, &#xA;        System.Web.Extensions, Ver

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend