Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

ASP.NET Global.asax file and LINQ to SQL

asp.net c# linq sql

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 Tchpowdog


    CC Regular

  • Member
  • PipPipPip
  • 44 posts

Posted 11 May 2015 - 08:23 AM

I am currently in development of an ASP.NET Web Forms site.  I have a good size database associated with the site, about 85 tables, and I use LINQ to SQL to communicate with the db.  On Session End event, close of browser, etc. I would like to log the user out.  To my understanding, I have to do this in the Global.asax file, correct?  Can I use LINQ to SQL in that file?  If so, can some post some code of what all this would look like?  Thanks guy!

#2 Tchpowdog


    CC Regular

  • Member
  • PipPipPip
  • 44 posts

Posted 02 June 2015 - 10:19 AM


#3 lespauled


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1360 posts

Posted 03 June 2015 - 07:13 AM

Yes, you should use the Global.asax for the session end.  No, you should never call database actions inside that method.  What you could do is call a self contained method in the business or database layer to handle the action you want, and to handle any exceptions there.

My Blog: http://forum.codecal...699-blog-77241/
"Women and Music: I'm always amazed by other people's choices." - David Lee Roth

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download