473,837 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calling application_end

My application_end event in global.asax is not working as-is. In order
to debug, I want to call it from another file, say debug.aspx through a
button, e.g. "end application". How do I call application_end in
global.asax from debug.aspx?

thanks

Nov 19 '05 #1
10 2914
Hi,
I have a problem, in my project. . .
How can i close the all the Sessions (Session.Abando n) and Explorer Window
with out any Confirmation.
Nov 19 '05 #2
In my project i am trying to maintain the Windows Authentication (Basic
Authentication) , the problem is like when i get to some pages the user will
be displayed with the Windows authentication page and some images will not
be displayed

i though like "_currUserIdent ity = User.Identity.N ame.ToString(); " by this
the problem is occuring as it is trying to find the User Identity every
time. . .
please try to solve the problem, user should not get the window untill the
session time out. . .

here is the following code used in the global.asax

---------------------------------------------------------------------------------------
protected void Session_Start(O bject sender, EventArgs e)
{
_currUserIdenti ty = User.Identity.N ame.ToString();
Session["currUserIdenti ty"] = _currUserIdenti ty;

try
{
Users usr=new Users();
usr.GetUserByLo ginName(_currUs erIdentity);
DataSet dsUser=usr.GetD ataSet();
if (dsUser.Tables[0].Rows.Count==0)
{
Session["CurrentUserNam e"] = _currUserName;
Response.Redire ct("UnAuthorise dAccess.aspx");
}
else if(dsUser.Table s[0].Rows.Count == 1)
{
Session["CurrentClientI D"] =
dsUser.Tables[0].Rows[0]["ClientID"].ToString();
Session["UserID"] =
Convert.ToInt32 (dsUser.Tables[0].Rows[0]["UserID"].ToString());
Response.Redire ct("index.aspx" );
}
else
{
Session["UserName"] = dsUser.Tables[0].Rows[0]["LoginName"].ToString();
Response.Redire ct("SelectClien t.aspx");
}
}
catch(Exception ex)
{
Session["ErrorMessa ge"] = ex.ToString();
}
}
---------------------------------------------------------------------------------------

and one more thing is the if the user is out with the session then i want
the user to be displayed with the message and that should be written in
global.asax << Now where should i manage that >>
Nov 19 '05 #3
"Raghuram" <rv******@gmail .com> wrote in message
news:un******** *****@TK2MSFTNG P10.phx.gbl...
How can i close the all the Sessions (Session.Abando n)
When you say "all the Sessions", do you mean you want to (effectively) throw
all users off your web application...?
and Explorer Window with out any Confirmation.


Hmm - again, what exactly are you trying to achieve here...?
Nov 19 '05 #4
newbie <pa*****@gmail. com> ha scritto:
My application_end event in global.asax is not working as-is. In order
to debug, I want to call it from another file, say debug.aspx through
a button, e.g. "end application". How do I call application_end in
global.asax from debug.aspx?

thanks


You can write in debug.aspx:
XmlDocument doc=new XmlDocument();
doc.Load(Reques t.MapPath("web. config"));
doc.Save(Reques t.MapPath("web. config"));

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
Nov 19 '05 #5
This is like i want to close the particular window rather than all the users
using the application. . .
just i want to close the page.

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:ep******** ********@TK2MSF TNGP14.phx.gbl. ..
"Raghuram" <rv******@gmail .com> wrote in message
news:un******** *****@TK2MSFTNG P10.phx.gbl...
How can i close the all the Sessions (Session.Abando n)


When you say "all the Sessions", do you mean you want to (effectively)
throw all users off your web application...?
and Explorer Window with out any Confirmation.


Hmm - again, what exactly are you trying to achieve here...?

Nov 19 '05 #6
"Raghuram" <rv******@gmail .com> wrote in message
news:OJ******** ******@TK2MSFTN GP12.phx.gbl...
This is like i want to close the particular window rather than all the
users using the application. . .
just i want to close the page.


I see - it was your phrase "all the Sessions" which made me wonder...

If you just want to tear down a session, put Session.Abandon () in the
Page_Load of the page where you want this to happen and Response.Redire ct to
another page.
Nov 19 '05 #7
javascript: window.close();

The behavior of the browser will differ according to how the window was
opened in the first place. If the user opened the browser window, the user
will be prompted and asked if he/she wants the window closed. If the window
was opoened by another browser window, it will close immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Paranoia is just a state of mind.

"Raghuram" <rv******@gmail .com> wrote in message
news:OJ******** ******@TK2MSFTN GP12.phx.gbl...
This is like i want to close the particular window rather than all the
users using the application. . .
just i want to close the page.

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:ep******** ********@TK2MSF TNGP14.phx.gbl. ..
"Raghuram" <rv******@gmail .com> wrote in message
news:un******** *****@TK2MSFTNG P10.phx.gbl...
How can i close the all the Sessions (Session.Abando n)


When you say "all the Sessions", do you mean you want to (effectively)
throw all users off your web application...?
and Explorer Window with out any Confirmation.


Hmm - again, what exactly are you trying to achieve here...?


Nov 19 '05 #8
According to you, i tried it, but the problem is like the user willl be
displayed with the Confirmation message, if the user selects no

private void lnkClose_Click( object sender, System.EventArg s e)
{
Response.Write( "<script language=javasc ript>window.clo se(); </script>");
Response.Cookie s.Clear();
FormsAuthentica tion.SignOut();
Session.Abandon ();
Session.Clear() ;
ViewState.Clear ();
}
please guide me. .. i should not have any confirmation and then close the
window.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
javascript: window.close();

The behavior of the browser will differ according to how the window was
opened in the first place. If the user opened the browser window, the user
will be prompted and asked if he/she wants the window closed. If the
window was opoened by another browser window, it will close immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Paranoia is just a state of mind.

"Raghuram" <rv******@gmail .com> wrote in message
news:OJ******** ******@TK2MSFTN GP12.phx.gbl...
This is like i want to close the particular window rather than all the
users using the application. . .
just i want to close the page.

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:ep******** ********@TK2MSF TNGP14.phx.gbl. ..
"Raghuram" <rv******@gmail .com> wrote in message
news:un******** *****@TK2MSFTNG P10.phx.gbl...

How can i close the all the Sessions (Session.Abando n)

When you say "all the Sessions", do you mean you want to (effectively)
throw all users off your web application...?

and Explorer Window with out any Confirmation.

Hmm - again, what exactly are you trying to achieve here...?



Nov 19 '05 #9
I solved the problem, i had put all the sessions and all the code in the
page load and by that user will be asked for yes or no if he tries to use
the back button(IE) the user is again taken to the first page with new
sessions

Thankyou. . ..
"Raghuram" <rv******@gmail .com> wrote in message
news:eO******** ******@TK2MSFTN GP10.phx.gbl...
According to you, i tried it, but the problem is like the user willl be
displayed with the Confirmation message, if the user selects no

private void lnkClose_Click( object sender, System.EventArg s e)
{
Response.Write( "<script language=javasc ript>window.clo se(); </script>");
Response.Cookie s.Clear();
FormsAuthentica tion.SignOut();
Session.Abandon ();
Session.Clear() ;
ViewState.Clear ();
}
please guide me. .. i should not have any confirmation and then close the
window.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
javascript: window.close();

The behavior of the browser will differ according to how the window was
opened in the first place. If the user opened the browser window, the
user will be prompted and asked if he/she wants the window closed. If the
window was opoened by another browser window, it will close immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Paranoia is just a state of mind.

"Raghuram" <rv******@gmail .com> wrote in message
news:OJ******** ******@TK2MSFTN GP12.phx.gbl...
This is like i want to close the particular window rather than all the
users using the application. . .
just i want to close the page.

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:ep******** ********@TK2MSF TNGP14.phx.gbl. ..
"Raghuram" <rv******@gmail .com> wrote in message
news:un******** *****@TK2MSFTNG P10.phx.gbl...

> How can i close the all the Sessions (Session.Abando n)

When you say "all the Sessions", do you mean you want to (effectively)
throw all users off your web application...?

> and Explorer Window with out any Confirmation.

Hmm - again, what exactly are you trying to achieve here...?



Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3196
by: Pedro Duque | last post by:
I've created a .net web service in c#. When there is no open session i need to free some resources. So, I've place the code on the Global.Application_End member. Unffortunatly it seems that the code is never executed (at least when i debug it). Help anyone?
3
16131
by: Jim Owen | last post by:
My .Net book states that the Application_End event handler in Global.asax gets called typically about 20 minutes after the last HTTP request. My question is: what is the best way to debug my Application_End code? I could of course add a button or something to a form to run the code explicitly, but I want to be sure it is really getting called after 20 minutes. I assume that if I put a breakpoint in my Application_End code, and then run the...
8
1857
by: Alphonse Giambrone | last post by:
I have a small asp.net web app running on a shared host. It uses a Jet (Access) database. I included a routine to compact the database when the application_event fires if it has not been compacted for a certain period of time. A compact must be done into a new file. In other words mydb.mdb compacts into mydb2.mdb. The original file (mydb.mdb) then gets deleted and mydb2.mdb is renamed to mydb.mdb. This routine works fine on another shared...
4
9228
by: Vlad Hrybok | last post by:
I am using Application_End to send out a notification about application being unloaded. I found that those notifications are not being sent because the app seems to get unloaded without Application_End ever being called. We started logging Application_Start and Application_End events and found that the number is not even: Application_Start happen more often than Application_End. My question is: What are the sutuations in which we should...
4
3057
by: J-T | last post by:
I have my applciation installed in an appplication pool (a worker process) -IIS 6.0-which is defined to be shut down after 20 minutes of being idle.If I put a breakpoint in Application_End method of Global.asax and there is no request for 20 minutes ,dose the breakpoint works for me? Is there a document which can gives me more infomration in this behaviour? Thanks
2
461
by: newbie | last post by:
I had posted this question but it got lost in another question. I'm posting it again: My application_end event in global.asax is not working as-is. In order to debug, I want to call it from another file, say debug.aspx through a button, e.g. "end application". How do I call application_end in global.asax from debug.aspx? thanks
1
2104
by: Navin Mishra | last post by:
Hi, If IIS Application Pool for a web service is called, shouldn't Application_End be called ? Some how I'm not seeing that. I've cached some client connection in Application object and I want to clear them in Application_End but I'm not able to. Thanks in advance and regards Navin
2
3284
by: Ido | last post by:
Hi, If asp process is being recycled/restarted gracefully, will Application_End allways be called? In addition, according to : http://www.codecomments.com/archive289-2005-2-393853.html one can understand that Application_End may not be able to finish its execution before the process is shut-down. That does not sound reasonable to me. What d'you say?
5
5204
by: Tenacious | last post by:
I am trying to shutdown a database server in the Application_End event handler on the Global.asax page. So far I am trying this only on the development server that comes with Visual Studio 2005. When I close the browser, this does not cause the Application_End event to trigger. It also will not occur when I shut down the development server. At this point the application is no longer running, so why didn't the event handler ever get called?...
0
9683
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10631
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10276
tracyyun
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...
0
9409
agi2029
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...
0
7006
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();...
0
5670
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...
1
4477
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3126
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.