469,945 Members | 1,762 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

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 2599
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Pedro Duque | last post: by
3 posts views Thread by Jim Owen | last post: by
8 posts views Thread by Alphonse Giambrone | last post: by
4 posts views Thread by Vlad Hrybok | last post: by
2 posts views Thread by newbie | last post: by
1 post views Thread by Navin Mishra | last post: by
2 posts views Thread by Ido | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.