Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-06-29
5
Medium Priority
?
2,583 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
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Hamed 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:Hamed 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 750 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

782 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