473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2868
Hi,
I have a problem, in my project. . .
How can i close the all the Sessions (Session.Abandon) 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 "_currUserIdentity = User.Identity.Name.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(Object sender, EventArgs e)
{
_currUserIdentity = User.Identity.Name.ToString();
Session["currUserIdentity"] = _currUserIdentity;

try
{
Users usr=new Users();
usr.GetUserByLoginName(_currUserIdentity);
DataSet dsUser=usr.GetDataSet();
if (dsUser.Tables[0].Rows.Count==0)
{
Session["CurrentUserName"] = _currUserName;
Response.Redirect("UnAuthorisedAccess.aspx");
}
else if(dsUser.Tables[0].Rows.Count == 1)
{
Session["CurrentClientID"] =
dsUser.Tables[0].Rows[0]["ClientID"].ToString();
Session["UserID"] =
Convert.ToInt32(dsUser.Tables[0].Rows[0]["UserID"].ToString());
Response.Redirect("index.aspx");
}
else
{
Session["UserName"] = dsUser.Tables[0].Rows[0]["LoginName"].ToString();
Response.Redirect("SelectClient.aspx");
}
}
catch(Exception ex)
{
Session["ErrorMessage"] = 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*************@TK2MSFTNGP10.phx.gbl...
How can i close the all the Sessions (Session.Abandon)
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(Request.MapPath("web.config"));
doc.Save(Request.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****************@TK2MSFTNGP14.phx.gbl...
"Raghuram" <rv******@gmail.com> wrote in message
news:un*************@TK2MSFTNGP10.phx.gbl...
How can i close the all the Sessions (Session.Abandon)


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**************@TK2MSFTNGP12.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.Redirect 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**************@TK2MSFTNGP12.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****************@TK2MSFTNGP14.phx.gbl...
"Raghuram" <rv******@gmail.com> wrote in message
news:un*************@TK2MSFTNGP10.phx.gbl...
How can i close the all the Sessions (Session.Abandon)


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.EventArgs e)
{
Response.Write("<script language=javascript>window.close(); </script>");
Response.Cookies.Clear();
FormsAuthentication.SignOut();
Session.Abandon();
Session.Clear();
ViewState.Clear();
}
please guide me. .. i should not have any confirmation and then close the
window.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2***************@TK2MSFTNGP15.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**************@TK2MSFTNGP12.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****************@TK2MSFTNGP14.phx.gbl...
"Raghuram" <rv******@gmail.com> wrote in message
news:un*************@TK2MSFTNGP10.phx.gbl...

How can i close the all the Sessions (Session.Abandon)

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**************@TK2MSFTNGP10.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.EventArgs e)
{
Response.Write("<script language=javascript>window.close(); </script>");
Response.Cookies.Clear();
FormsAuthentication.SignOut();
Session.Abandon();
Session.Clear();
ViewState.Clear();
}
please guide me. .. i should not have any confirmation and then close the
window.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2***************@TK2MSFTNGP15.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**************@TK2MSFTNGP12.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****************@TK2MSFTNGP14.phx.gbl...
"Raghuram" <rv******@gmail.com> wrote in message
news:un*************@TK2MSFTNGP10.phx.gbl...

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

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
"Raghuram" <rv******@gmail.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
please guide me. .. i should not have any confirmation and then close the
window. Response.Write("<script language=javascript>window.close(); </script>");


Response.Write("<script
language=javascript>window.opener=null;window.clos e(); </script>");
Nov 19 '05 #11

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

Similar topics

1
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...
3
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...
8
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...
4
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...
4
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...
2
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...
1
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...
2
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...
5
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....
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...

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.