Solved

How to display an popup error message from the global.asax file

Posted on 2006-06-29
5
2,277 Views
Last Modified: 2012-06-27
Hello all,

I'm handling unexpected exceptions in the Global.asax's Application_Error event.  The current code in the Application_Error event gathers the exception info and notifies the dev staff, then redirects the user to an friendly error page with a link to the application's home page. The issue I'm having is that there is a process which opens a page in a new window where additional processing occurs.  If an exception occurs in the new window, the home page redirection, of course, takes place from that point. What I would like to do is open the error page in a separate window via jscript, but this doesn't seem possible from global asax.  Any suggestions would be appreciated.
0
Comment
Question by:LloydMc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:zaghaghi
ID: 17010664
use alert java script function
0
 

Author Comment

by:LloydMc
ID: 17010885
Zaghaghi,

How would I do this? I can't inject any script from global.asax since I don't have access to the response object.
0
 
LVL 9

Expert Comment

by:zaghaghi
ID: 17010991
when you cath the errors in global.asax you can redirect to a page that shows error(s)

why do you need to display an popup error?
0
 

Author Comment

by:LloydMc
ID: 17011100
Zaghaghi,

As I explained above, there is a process that executes in a page that was opened in a separate window, so if an exception occurs in that window, any navigation will occur in that window's space, leaving the previous window open in the background. Also, I don't want to navigate away from the current page.
0
 
LVL 5

Accepted Solution

by:
vinodhsomasekharan earned 250 total points
ID: 17016552

Hai.
In Application_Error() event of global.asax page
if your objective is to redirect to another aspx page then u can
  use response.redirect or server.transfer
eg.. Server.Transfer("../DataGrid/DataGridSample1.aspx", True)

if u want to use a javascript function to redirect to another aspx page then u can try this

        HttpContext.Current.Response.Write("<html><script language='javascript'>alert('error comes here');window.location.href='../DataGrid/DataGridSample1.aspx';</script></html>")
        Server.ClearError()
Note: just save u r error message in a session varible or pass it as an argument to the new page before giving server.clearerror() else u might loose the error details...
eg: HttpContext.Current.Session("hh") = Server.GetLastError.GetBaseException.Message

Hope it helps u,

Regards
Vinodh


       
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question