Click here to Skip to main content
15,915,093 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: FormView mode again( urgent) Pin
minhpc_bk12-Jul-06 23:25
minhpc_bk12-Jul-06 23:25 
GeneralRe: FormView mode again( urgent) Pin
srinandan..13-Jul-06 1:32
srinandan..13-Jul-06 1:32 
Questioncodebehind system namespace Pin
mamatha_raghu12-Jul-06 21:47
mamatha_raghu12-Jul-06 21:47 
AnswerRe: codebehind system namespace Pin
g00fyman12-Jul-06 23:20
g00fyman12-Jul-06 23:20 
QuestionHow to use mouseover event on datalist control. Pin
Amit Agarrwal12-Jul-06 20:46
Amit Agarrwal12-Jul-06 20:46 
QuestionHow to add print function ? Pin
cheeken2u12-Jul-06 20:13
cheeken2u12-Jul-06 20:13 
AnswerRe: How to add print function ? Pin
mnaveed13-Jul-06 1:08
mnaveed13-Jul-06 1:08 
QuestionServer.GetLastError() not working [modified] Pin
g00fyman12-Jul-06 20:02
g00fyman12-Jul-06 20:02 
Hi all,

I am running ASP 2 on IIS 5.1 XPPRO and I have enabled customErrors, so i though i would see how they look locally and set mode=On.

this is the code that fires the exception:
protected void AddToQuoteButton_Click(object sender, ImageClickEventArgs e)
{
  try
  {
    Guid guid = new Guid(Request.QueryString["id"]);
    QuoteManager.AddToQuote(Page, guid);
  }
  catch (Exception ex)
  {
    throw new Exception("Illegal Product Code in query string.", ex);
  }
}


and this is the custom 500 error page logic

public partial class _500 : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if(Server.GetLastError() != null)
    {
      string error = Server.GetLastError().Message;
      ErrorLabel.Text = error;

      Server.ClearError();
    }    
  }
}



so i load a page which requires a Guid on the querystring (but i chop some of the guid off) then click the button whose handler is above, and it goes to the 500.aspx page but Server.GetLastError() is always null.

note: it is suppose to go to 500.aspx on load but i disabled that to do some testing.

why is this?
kind regards,
g00fy

-- modified at 2:02 Thursday 13th July, 2006

this is the web.config section

<customErrors mode="On" defaultRedirect="~/500.aspx">
    <error statusCode="404" redirect="~/404.aspx"/>
</customErrors>

AnswerRe: Server.GetLastError() not working Pin
kumarprabhakar7412-Jul-06 20:25
kumarprabhakar7412-Jul-06 20:25 
AnswerRe: Server.GetLastError() not working Pin
minhpc_bk12-Jul-06 20:35
minhpc_bk12-Jul-06 20:35 
GeneralRe: Server.GetLastError() not working Pin
g00fyman12-Jul-06 23:03
g00fyman12-Jul-06 23:03 
QuestionMultiple Insert without postback Pin
Tiger45612-Jul-06 19:56
Tiger45612-Jul-06 19:56 
AnswerRe: Multiple Insert without postback Pin
Amit Agarrwal12-Jul-06 20:57
Amit Agarrwal12-Jul-06 20:57 
GeneralRe: Multiple Insert without postback Pin
Tiger45613-Jul-06 18:17
Tiger45613-Jul-06 18:17 
AnswerRe: Multiple Insert without postback Pin
kumarprabhakar7412-Jul-06 21:43
kumarprabhakar7412-Jul-06 21:43 
AnswerRe: Multiple Insert without postback Pin
Not Active13-Jul-06 2:15
mentorNot Active13-Jul-06 2:15 
GeneralRe: Multiple Insert without postback Pin
Tiger45613-Jul-06 18:19
Tiger45613-Jul-06 18:19 
QuestionMicrosoft content management server 2002 Pin
Kanjinghat12-Jul-06 19:44
Kanjinghat12-Jul-06 19:44 
Question2 Dimensional Array (Urgent) Pin
kirthikirthi12-Jul-06 19:01
kirthikirthi12-Jul-06 19:01 
AnswerRe: 2 Dimensional Array (Urgent) Pin
minhpc_bk12-Jul-06 19:53
minhpc_bk12-Jul-06 19:53 
GeneralRe: 2 Dimensional Array (Urgent) Pin
kirthikirthi12-Jul-06 21:22
kirthikirthi12-Jul-06 21:22 
QuestionASP.NET Themes and RSS.aspx... Pin
Matt Newman12-Jul-06 16:34
Matt Newman12-Jul-06 16:34 
AnswerRe: ASP.NET Themes and RSS.aspx... Pin
minhpc_bk12-Jul-06 17:16
minhpc_bk12-Jul-06 17:16 
GeneralRe: ASP.NET Themes and RSS.aspx... Pin
Matt Newman12-Jul-06 17:38
Matt Newman12-Jul-06 17:38 
Questionhow to use RegisterClentScriptInclude Pin
anu_chandu12-Jul-06 13:03
anu_chandu12-Jul-06 13:03 

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.