Developer forum

Forum » Development » Display Stacktrace on error

Display Stacktrace on error


Reply

I just set up a DW local solution and every error I get it redirects to a Dynamic Customerror page.

 

Does anybody know how to turn this off so I can see the stacktrace?

 

- Sune


Replies

 
Reply

 

 Does anybody know how to turn this off so I can see the stacktrace?


try {

 // error occurs

} catch (Exception ex) {

    HttpContext.Current.Response.Write(ex.ToString());

}

That should do it.

 
Reply
ks wrote:

 

 Does anybody know how to turn this off so I can see the stacktrace?


try {

 // error occurs

} catch (Exception ex) {

    HttpContext.Current.Response.Write(ex.ToString());

}

That should do it.

Thanks for the fast reply but it doesnt work even if an exception is caught I still get redirected to DWs errorpage.

 

I'm more looking for a way to turn customerrors off so the page just displays the stacktrace.

 

- Sune

 
Reply

I found out that the page redirects on errors occurring in the aspx files.

 

but the strange thing is that if fx I test with an exception like this: <%=Convert.Toint32("awer")%>

 

I get the correct Compiler warning with line number and all.

 

But if I test with something like: <%=this.Doesntexist %> I get redirected to the DW errorpage.

 

I have another solution where the <%=this.Doesntexist %> exception displays the correct compiler warning.

 

Any idea what makes this difference?

 

- Sune

 
Reply
sune@fonqi.dk wrote:

I found out that the page redirects on errors occurring in the aspx files.

 

but the strange thing is that if fx I test with an exception like this: <%=Convert.Toint32("awer")%>

 

I get the correct Compiler warning with line number and all.

 

But if I test with something like: <%=this.Doesntexist %> I get redirected to the DW errorpage.

 

I have another solution where the <%=this.Doesntexist %> exception displays the correct compiler warning.

 

Any idea what makes this difference?

 

- Sune

The difference could be how the modules are implemented into the solution - in old days we had to modify Default.aspx and attach our module hooks into the switch - block at the buttom - this implementation would cause you 2nd behaviour.
 

The nw way is where you mark you class with [AddInName("nameofmodule")] and inherit from ContentModule. This way DW is instantiating via some Reflection/Provider model and DW can then capsulate the whole module call inside a try/catch and this way I think they produce the redirect of they detect uncaught exceptions.

 

-Kevin

 
Reply
ks wrote:
sune@fonqi.dk wrote:

I found out that the page redirects on errors occurring in the aspx files.

 

but the strange thing is that if fx I test with an exception like this: <%=Convert.Toint32("awer")%>

 

I get the correct Compiler warning with line number and all.

 

But if I test with something like: <%=this.Doesntexist %> I get redirected to the DW errorpage.

 

I have another solution where the <%=this.Doesntexist %> exception displays the correct compiler warning.

 

Any idea what makes this difference?

 

- Sune

The difference could be how the modules are implemented into the solution - in old days we had to modify Default.aspx and attach our module hooks into the switch - block at the buttom - this implementation would cause you 2nd behaviour.
 

The nw way is where you mark you class with [AddInName("nameofmodule")] and inherit from ContentModule. This way DW is instantiating via some Reflection/Provider model and DW can then capsulate the whole module call inside a try/catch and this way I think they produce the redirect of they detect uncaught exceptions.

 

-Kevin

That sounds plausible.

But both errors occur in the backend (Admin files) and both modules are implemented in the new style with the addinname but the one that keeps redirecting is created with the newest files from DW and it could be therein the problem lies.

 
Reply

Are you sure it's a 500 error? It might me the path to your module pages that are incorrect, and the the DW 404 page will be displayed (blue background with Dynamicweb logo and "Page cannot be found" printed on it).

 
Reply

I'm positive because we tested by writing out some methods from the Code behind.

But again I've never experienced this before with DW and this is an new employee who has set up a Visual studio solution in a slightly different way than I usually do.

So the problem is most likely something with our setup. I just wanted to check if anybody had experienced the same problem or DW had changed some things in the new Files, which differentiates in our projects.

But I will reply to this thread if I find out what the problem is.

 

- Sune

 
Reply

The code in the aspx file does not get compiled, so it produces a runtime error.

 

But I'm curious about the error page. Usually I receive a big fat server error message. Could you supply a screen dump of what you're getting?

 
Reply
Sorensen wrote:

The code in the aspx file does not get compiled, so it produces a runtime error.

 

But I'm curious about the error page. Usually I receive a big fat server error message. Could you supply a screen dump of what you're getting?

http://fonqi4.dk/sune/dynamicwebscreenshot.png

 

We get this error page when we in the aspx file call a nonsens class as in: <%=happa.dubba(1)%>

 

If we in the code behind file create an exception like in Convert.ToInt32("happadubba"); we get the server error message.

 

- Sune

 
Reply

This is the Dynamicweb 404 - File Not Found page. It's not a server error, but simply means that the requested page not be found.

 

Could it be a redirect in your code that has a rotten path? When does the error occur? When you enter the module from the Modules page?

 

You must be logged in to post in the forum