I am building a web app for users to add/edit data. They may add/edit
several records during a session.
When they are done (not necessarily immediately, could be 10 or more minutes
later), I need to send an email with some summary info of what was
added/edited.
I can keep track of the records by using the sessionid or user's login, but
how can I determine when to send the email and who the user was since there
is no session info available in the session_end event?
This will be on a commercial web server so scheduled tasks is not an option.
Is there some method of looping through the active sessions on an
application level so that I could compare the active sessionid's (or session
variables) with those saved to a db during editing?
TIA
--
Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us 17 2101
"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in
news:Ob******** ******@TK2MSFTN GP14.phx.gbl: I can keep track of the records by using the sessionid or user's login, but how can I determine when to send the email and who the user was since there is no session info available in the session_end event?
You could fire off a new thread to do the database work, then send the e-
mail once the thread is done?
--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
Thanks for the reply Lucas.
I don't quite understand. I don't want to send an email every time the user
edits a record. I want to send it when they are done with ALL their editing.
They may edit 1 record or many and I can't depend on a user clicking a
button when they are done with all.
The concept of session_end would be ideal except when (if) it fires, there
is nothing left to identify who the session belonged to.
--
Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Lucas Tam" <RE********@rog ers.com> wrote in message
news:Xn******** *************** ****@140.99.99. 130... "Alphonse Giambrone" <NO**********@e xample.invalid> wrote in news:Ob******** ******@TK2MSFTN GP14.phx.gbl:
I can keep track of the records by using the sessionid or user's login, but how can I determine when to send the email and who the user was since there is no session info available in the session_end event?
You could fire off a new thread to do the database work, then send the e- mail once the thread is done?
-- Lucas Tam (RE********@rog ers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
Hi Alphonse,
From your description, you're building an asp.net web application in which
the users can edit some datas which stored in session and when the user's
session is timeout, we need to send a mail to him with his editing datas.
However, you found its unable to retrieve the sessionid in the Session_end
event , so you're wondering some means to get that, yes?
As for problem, I think maybe cookie is a possible approach, since the
cookies are stored on the client mahcine and still accessable in
Session_End, you can try generate a identical key when the user login and
store in cookie to idenitfy him. And in Session_End , use this cookie value
to get the data for the user.
In addition, the Session_End event seems only work for InProcess Model
session, so if you'll care this problem, there is also another approach
that use the Application Cache to store the user's data. Just define a
certain cache object for storing each user's data and we can specify a
Expire Time and add EXpire event handler for cache object in asp.net.
Just some of my suggestions. Hope helps.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hello,
You could use a domain object that will hold the users information
and when a user logs in, save this object into the session. You will
update the object when the user performs an action on your site like
insert, update, delete record. In the Session_End event you can
retrieve your domain object from the session.
Here is an example which worked for me:
// The domain object
public class User
{
// Unique identifier of the user
private string _id;
// Holds information about the operations that the user performed
in this session
private ArrayList _performedOpera tions;
public User(string id)
{
_id = id;
_performedOpera tions = new ArrayList();
}
public string Id
{
get { return _id; }
}
public ArrayList PerformedOperat ions
{
get { return _performedOpera tions; }
}
}
protected void Session_Start(O bject sender, EventArgs e)
{
User user = new User(Guid.NewGu id().ToString() );
Session.Add("us er", user);
}
protected void Session_End(Obj ect sender, EventArgs e)
{
User user = (User) Session["user"];
// send email here.
}
Don't forget to adjust the timeout attribute in your web.config
file. For testing you can set its value to 1 and observe that the
Sesssion_End event is fired after 1 min of inactivity from the user.
HTH,
Darin
Steven,
Thanks for the idea. I was not aware of the Expire event handler for cache
objects, but it sounds like it would work.
Do you have an example of using it?
Where is it accessed from, the global.asax?
--
Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:cg******** ******@cpmsftng xa10.phx.gbl... Hi Alphonse,
From your description, you're building an asp.net web application in which the users can edit some datas which stored in session and when the user's session is timeout, we need to send a mail to him with his editing datas. However, you found its unable to retrieve the sessionid in the Session_end event , so you're wondering some means to get that, yes?
As for problem, I think maybe cookie is a possible approach, since the cookies are stored on the client mahcine and still accessable in Session_End, you can try generate a identical key when the user login and store in cookie to idenitfy him. And in Session_End , use this cookie
value to get the data for the user.
In addition, the Session_End event seems only work for InProcess Model session, so if you'll care this problem, there is also another approach that use the Application Cache to store the user's data. Just define a certain cache object for storing each user's data and we can specify a Expire Time and add EXpire event handler for cache object in asp.net.
Just some of my suggestions. Hope helps.
Regards,
Steven Cheng Microsoft Online Support
Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
Darin,
Thanks for the interesting suggestion.
Could you please explain a bit.
It seems like you are storing the user object in session.
I had believed that nothing stored in session was available within the
session_end event.
--
Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"darin dimitrov" <da************ @hotmail.com> wrote in message
news:2b******** *************** ***@posting.goo gle.com... Hello,
You could use a domain object that will hold the users information and when a user logs in, save this object into the session. You will update the object when the user performs an action on your site like insert, update, delete record. In the Session_End event you can retrieve your domain object from the session.
Here is an example which worked for me:
// The domain object public class User { // Unique identifier of the user private string _id; // Holds information about the operations that the user performed in this session private ArrayList _performedOpera tions; public User(string id) { _id = id; _performedOpera tions = new ArrayList(); }
public string Id { get { return _id; } }
public ArrayList PerformedOperat ions { get { return _performedOpera tions; } }
}
protected void Session_Start(O bject sender, EventArgs e) { User user = new User(Guid.NewGu id().ToString() ); Session.Add("us er", user); }
protected void Session_End(Obj ect sender, EventArgs e) { User user = (User) Session["user"]; // send email here. }
Don't forget to adjust the timeout attribute in your web.config file. For testing you can set its value to 1 and observe that the Sesssion_End event is fired after 1 min of inactivity from the user.
HTH,
Darin
Don't believe you can access session variables from within Session_End.
Greg
"darin dimitrov" <da************ @hotmail.com> wrote in message
news:2b******** *************** ***@posting.goo gle.com... Hello,
You could use a domain object that will hold the users information and when a user logs in, save this object into the session. You will update the object when the user performs an action on your site like insert, update, delete record. In the Session_End event you can retrieve your domain object from the session.
Here is an example which worked for me:
// The domain object public class User { // Unique identifier of the user private string _id; // Holds information about the operations that the user performed in this session private ArrayList _performedOpera tions; public User(string id) { _id = id; _performedOpera tions = new ArrayList(); }
public string Id { get { return _id; } }
public ArrayList PerformedOperat ions { get { return _performedOpera tions; } }
}
protected void Session_Start(O bject sender, EventArgs e) { User user = new User(Guid.NewGu id().ToString() ); Session.Add("us er", user); }
protected void Session_End(Obj ect sender, EventArgs e) { User user = (User) Session["user"]; // send email here. }
Don't forget to adjust the timeout attribute in your web.config file. For testing you can set its value to 1 and observe that the Sesssion_End event is fired after 1 min of inactivity from the user.
HTH,
Darin
Dear newsgroup readers,
Please forgive me if I provided some wrong information as I am not
an advanced .NET developper. What I am sure of although is that the
code snippet I provided works great for me and I can access session
state variables in the Session_End event. The only problem with this
event is that it is fired only if you are using *InProc* as a session
state (never fired if you use StateServer or SQLServer but there is a
workaround).
Thanks,
Darin
"Greg Burns" <greg_burns@DON T_SPAM_ME_hotma il.com> wrote in message news:<uo******* ******@TK2MSFTN GP09.phx.gbl>.. . Don't believe you can access session variables from within Session_End.
Hi Alphonse,
As for the cache object's expire event, it is fired when the cache object
will be removed from the application cache and we can register a
OnRemoveCallBac k handler for each cache object. Here is the msdn doc
discussing on this:
#Notifying an Application When an Item Is Deleted from the Cache http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconnotifyinga pplicationswhen itemisdeletedfr omcache.asp
In addition , below is another tech article which make use of the
OnRemoveCallBac k to notify when cache object will expire:
#Prevent Multiple Logins Using the Cache in ASP.NET http://www.eggheadcafe.com/articles/20030416.asp
Hope also helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vincent |
last post by:
Hi,
If i login to the site again (may be in the same pc or
different pc), system must allow me in and end my previous
session.
How do i go about doing this?
This is to ensure that an user can have only one session
at a time.
|
by: Lawrance |
last post by:
DearAll:
How do I restrict to the same user's double_login?
Is there any way to solve this problem under "user closed browser" or
"computer crash" condition ?
Best Regards,
Lawrance Chang
|
by: Dan Walls |
last post by:
Hi,
I am looking to clean up some database locks whenever a user session ends. A
user session ends whenever they:
a. shut down the browser and the session times out after 20 mins (20 mins is
the default)
b. they click logout button and I call session.abandon()
However a user session ID can be the same over multiple sessions if it is in
|
by: Razak |
last post by:
Hi,
I have a class which basically do Impersonation in my web application. From
MS KB sample:-
++++++++++++++++++++code starts
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
|
by: news.microsoft.com |
last post by:
Hi everyone,
I need some help (may be in the form of some sample code) for the subject
question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the
session ends. I don't want to depend on the session timeout factor since it
may end too soon or it may hang around too long. I can't find any event
that fires when the browser closes. The Session_End event handler in the
Global.asax does not execute until the...
| |
by: Michel |
last post by:
Hi, I wrote an app in .Net and I whant only 1 instance of this app open for
the user; the user open my app, do some works and try to open another
instance of my app, I whant to show a message to user to inform him that only
one instance is permit and then close the second instance after that.
I am able to do this when the user run the application on his PC whit this :
Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName)
...
|
by: Laurahn |
last post by:
How can i configure my application for closing the session ? How can i use
the session end for closing the session ?
|
by: dudelideisann |
last post by:
Hi!
I have a form where the user enters some input. The input will eventionally become a database table. When he hit the 'submit' button the info is put into an array and then into a session variable for later. The session gets it's name from the user inputfield 'tablename' ..
Then, if the user wants to he can then proceed to 'checkout.php' or he can make a new input in another form and hit the submit button again. The same will happen...
|
by: Ron J |
last post by:
I would like to keep track of users when they are 'on'. On Session_Start I
can write a DB record about them, but there does not seem to be session
variable information during the Session_end event which I could use to
update the record that they are logged out. This would also be nice to limit
multiple logins.
Is there a preferred way to track users login / logout /session time and
multiple logins ?
TIA
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |