I have this code that appears at the top of every page
I have tried putting this into my master page, however, the error
message doesnt appear when I do this even though I have the variables
declared in the other pages.
<asp:Content id="contentErrors" ContentPlaceHolderID="siteErrors"
runat="server">
<% if (pageErrors) { %>
<div class="siteError">
<h2>Error</h2><em><%=pageError %></em>
</div>
<% } %>
</asp:Content>
I could use an iframe and link a error.aspx page within it and pass
the values as parameters via the URL, but this seems cumbersome to me.
Any suggestions?
Showjumper - 06 Sep 2007 02:40 GMT
You can set a custom error page in web.config. Is that what you need? Also
you can use Server.GetLastError to get the error message.
>I have this code that appears at the top of every page
>
[quoted text clipped - 15 lines]
>
> Any suggestions?
Vince - 06 Sep 2007 02:58 GMT
> You can set a custom error page in web.config. Is that what you need? Also
>
[quoted text clipped - 17 lines]
>
> > Any suggestions?
Well thats a whole error page, im just looking at a div that appears
at the top of every page and is only displayed when needed.
Ill have a look at GetLastError. Cheers.
Vince - 07 Sep 2007 02:02 GMT
> > You can set a custom error page in web.config. Is that what you need? Also
> > you can use Server.GetLastError to get the error message."Vince" <panuccio.vi...@gmail.com> wrote in message
[quoted text clipped - 25 lines]
>
> Ill have a look at GetLastError. Cheers.
Actually I checkd GetLastError. This seems more to do with application
level errors. Im after something for user errors such as missing data
entry or wrong formatted date.
Anyone?
Juan T. Llibre - 07 Sep 2007 03:16 GMT
re:
!> Im after something for user errors such as missing data entry or wrong formatted date.
For that, use structured error exception handling.
( Try, Catch, Finally )
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
>> > You can set a custom error page in web.config. Is that what you need? Also
>> > you can use Server.GetLastError to get the error message."Vince" <panuccio.vi...@gmail.com> wrote in message
[quoted text clipped - 31 lines]
>
> Anyone?
Larry Bud - 07 Sep 2007 13:05 GMT
> I have this code that appears at the top of every page
>
[quoted text clipped - 15 lines]
>
> Any suggestions?
What about in a user control?
Ghostman - 07 Sep 2007 16:16 GMT
Sorry for the Hijack..
speaking of Error Handling. I have set it up at the Application level
a few times using global.asax, but is there a way to set up a default
global.asax file that i can have multiple asp.net applications point
to?
ThunderMusic - 07 Sep 2007 18:48 GMT
Hi,
I think it's a "BasePage" case... If you make all your pages inherit from a
"BasePage" class (that inherits from Page), you can put everything you want
"global" in this "BasePage" without needing every single page to declare for
example the 'pageErrors' variable.
I hope it helps
ThunderMusic
>I have this code that appears at the top of every page
>
[quoted text clipped - 15 lines]
>
> Any suggestions?
ThunderMusic - 07 Sep 2007 18:51 GMT
hi
btw, I also agree with Larry Bud's post saying you could use a user control,
but you would still need to copy-paste the usercontrol to every single
page... coupled with the "BasePage", it could be terrific... ;)
I hope it helps
ThunderMusic
> Hi,
> I think it's a "BasePage" case... If you make all your pages inherit from
[quoted text clipped - 25 lines]
>>
>> Any suggestions?