Click here to Skip to main content
15,906,766 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: History List for a Form Field Pin
User 171649223-Aug-06 7:37
professionalUser 171649223-Aug-06 7:37 
GeneralRe: History List for a Form Field Pin
Jeremy Falcon23-Aug-06 7:46
professionalJeremy Falcon23-Aug-06 7:46 
GeneralRe: History List for a Form Field Pin
User 171649223-Aug-06 8:05
professionalUser 171649223-Aug-06 8:05 
GeneralRe: History List for a Form Field Pin
David Stone23-Aug-06 9:21
sitebuilderDavid Stone23-Aug-06 9:21 
GeneralRe: History List for a Form Field Pin
#realJSOP23-Aug-06 10:55
professional#realJSOP23-Aug-06 10:55 
GeneralRe: History List for a Form Field Pin
ToddHileHoffer23-Aug-06 7:48
ToddHileHoffer23-Aug-06 7:48 
GeneralRe: History List for a Form Field [modified] Pin
#realJSOP23-Aug-06 10:46
professional#realJSOP23-Aug-06 10:46 
QuestionCustom error page is ignored Pin
ake_krakbar23-Aug-06 4:45
ake_krakbar23-Aug-06 4:45 
Hello folks!
I´ve implemented some custom error handling that writes the error to a log file then redirects the user to my custom error page. The strange thing is: this all works fine when i run the project in VS2005 using f5 but when i just choose to directly go to any page causing an error (like 'view in browser') error logging still works ok but my custom error page is ignored. Instead the regular asp.net error page is used.

It´s done like this...
First the web.config:

<httpModules>
<add type="Munkeby.Web.ErrorHandlingModule, CaseComponents" name="ErrorHandler" />
</httpModules>

My httpModule:
public class ErrorHandlingModule : IHttpModule
{
private HttpApplication application;

void IHttpModule.Init(HttpApplication app)
{
this.application = app;
this.application.Error += new EventHandler(ErrorHandler);
}

private void ErrorHandler(Object sender, EventArgs e)
{
Exception ex = application.Server.GetLastError();

string errorString = "\n\n" + DateTime.Now.ToString() + " " + ex.Message + "\nInnerException: " + ex.InnerException;

TextWriter tw = File.AppendText(application.Server.MapPath("errorLog.txt"));
tw.WriteLine(errorString);
tw.Close();

application.Server.Execute("Error.aspx");
application.Server.ClearError();
}

#region IHttpModule Members
public void Dispose()
{
}
#endregion
}

And, finally the error page:
protected void Page_Load(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex != null)
lblErrorMessage.Text = ex.Message + "<br /><br />" + ex.InnerException;
}

Hope it makes sense.
/J
AnswerRe: Custom error page is ignored Pin
ToddHileHoffer23-Aug-06 5:31
ToddHileHoffer23-Aug-06 5:31 
GeneralRe: Custom error page is ignored Pin
ake_krakbar24-Aug-06 1:43
ake_krakbar24-Aug-06 1:43 
QuestionWeb.config path Pin
seee sharp23-Aug-06 4:27
seee sharp23-Aug-06 4:27 
AnswerRe: Web.config path Pin
Guffa23-Aug-06 4:34
Guffa23-Aug-06 4:34 
QuestionRe: Web.config path Pin
seee sharp23-Aug-06 4:42
seee sharp23-Aug-06 4:42 
AnswerRe: Web.config path Pin
seee sharp23-Aug-06 4:48
seee sharp23-Aug-06 4:48 
AnswerRe: Web.config path Pin
Guffa23-Aug-06 12:08
Guffa23-Aug-06 12:08 
GeneralRe: Web.config path Pin
seee sharp25-Aug-06 1:15
seee sharp25-Aug-06 1:15 
AnswerRe: Web.config path Pin
Guffa25-Aug-06 9:37
Guffa25-Aug-06 9:37 
Questionfolder browser dialog Pin
248912823-Aug-06 4:25
248912823-Aug-06 4:25 
AnswerRe: folder browser dialog Pin
ake_krakbar23-Aug-06 4:47
ake_krakbar23-Aug-06 4:47 
GeneralRe: folder browser dialog Pin
248912823-Aug-06 4:52
248912823-Aug-06 4:52 
QuestionASP.NET passing values from one form to another? Pin
Solly7423-Aug-06 4:01
Solly7423-Aug-06 4:01 
AnswerRe: ASP.NET passing values from one form to another? Pin
_AK_23-Aug-06 4:03
_AK_23-Aug-06 4:03 
GeneralRe: ASP.NET passing values from one form to another? Pin
Not Active23-Aug-06 4:10
mentorNot Active23-Aug-06 4:10 
GeneralRe: ASP.NET passing values from one form to another? Pin
_AK_23-Aug-06 4:22
_AK_23-Aug-06 4:22 
GeneralRe: ASP.NET passing values from one form to another? Pin
Solly7423-Aug-06 8:02
Solly7423-Aug-06 8:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.