Exceptionhandling & errormessage

Discussion in 'ASP .Net' started by BenCoo, Apr 28, 2007.

  1. BenCoo

    BenCoo Guest

    Hi,

    In my ASP.NET application I do some exceptionhandling and redirect the
    exception with Session("Exception") to an Errorpage.aspx. When I put the
    error in a label I get the following :

    System.NotSupportedException: Inserting is not supported by ObjectDataSource
    'objDsrLocationEdit' unless the InsertMethod is specified. at
    System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
    values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
    DataSourceViewOperationCallback callback) at
    System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
    Boolean causesValidation) at
    System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
    causesValidation, String validationGroup) at
    System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs
    e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
    at System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
    EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    EventArgs args) at
    System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
    System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
    eventArgument) at
    System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    eventArgument) at
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
    String eventArgument) at
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
    Boolean includeStagesAfterAsyncPoint)

    This is way to much ... I want just this :

    System.NotSupportedException: Inserting is not supported by ObjectDataSource
    'objDsrLocationEdit' unless the InsertMethod is specified.

    Is that possible ?

    Thanks for any help on this,

    Benny
    BenCoo, Apr 28, 2007
    #1
    1. Advertising

  2. BenCoo

    Teemu Keiski Guest

    Are you setting the Message in the Label, or just taking ToString() on the
    Exception object? If you take just Message property, that should be what you
    look for.

    Label1.Text = exceptionobject.Message


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net



    "BenCoo" <> wrote in message
    news:UCNYh.146323$-ops.be...
    > Hi,
    >
    > In my ASP.NET application I do some exceptionhandling and redirect the
    > exception with Session("Exception") to an Errorpage.aspx. When I put the
    > error in a label I get the following :
    >
    > System.NotSupportedException: Inserting is not supported by
    > ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    > specified. at
    > System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
    > values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
    > DataSourceViewOperationCallback callback) at
    > System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
    > Boolean causesValidation) at
    > System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
    > causesValidation, String validationGroup) at
    > System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source,
    > EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    > EventArgs args) at
    > System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
    > EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    > EventArgs args) at
    > System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
    > System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
    > eventArgument) at
    > System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    > eventArgument) at
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
    > String eventArgument) at
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >
    > This is way to much ... I want just this :
    >
    > System.NotSupportedException: Inserting is not supported by
    > ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    > specified.
    >
    > Is that possible ?
    >
    > Thanks for any help on this,
    >
    > Benny
    >
    Teemu Keiski, Apr 28, 2007
    #2
    1. Advertising

  3. BenCoo

    Jeeva S Guest

    On Apr 28, 11:53 pm, "BenCoo" <> wrote:
    > Hi,
    >
    > In my ASP.NET application I do some exceptionhandling and redirect the
    > exception with Session("Exception") to an Errorpage.aspx. When I put the
    > error in a label I get the following :
    >
    > System.NotSupportedException: Inserting is not supported by ObjectDataSource
    > 'objDsrLocationEdit' unless the InsertMethod is specified. at
    > System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
    > values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
    > DataSourceViewOperationCallback callback) at
    > System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
    > Boolean causesValidation) at
    > System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
    > causesValidation, String validationGroup) at
    > System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs
    > e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
    > at System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
    > EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    > EventArgs args) at
    > System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
    > System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
    > eventArgument) at
    > System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler..RĀ­aisePostBackEvent(String
    > eventArgument) at
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
    > String eventArgument) at
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
    > System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
    > Boolean includeStagesAfterAsyncPoint)
    >
    > This is way to much ... I want just this :
    >
    > System.NotSupportedException: Inserting is not supported by ObjectDataSource
    > 'objDsrLocationEdit' unless the InsertMethod is specified.
    >
    > Is that possible ?
    >
    > Thanks for any help on this,
    >
    > Benny


    if u can post ur code, wud be better to find the problem
    Jeeva S, Apr 29, 2007
    #3
  4. BenCoo

    BenCoo Guest

    Re: Exceptionhandling & errormessage - Codesnippped

    Hi,

    In the page where I put the exceptionhandling I have the following code:


    Protected Sub Page_Error(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Error
    Dim ex As Exception
    ex = Server.GetLastError
    Session("Exception") = ex.ToString
    Response.Redirect("ErrorPage.aspx")
    End Sub

    And in the ErrorPage.aspx

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Handles Me.Load
    If Not IsPostBack Then
    Me.lblError.Text = Session("Exception")
    Session.Remove("Exception")
    End If
    End Sub

    Thanks !

    "BenCoo" <> schreef in bericht
    news:UCNYh.146323$-ops.be...
    > Hi,
    >
    > In my ASP.NET application I do some exceptionhandling and redirect the
    > exception with Session("Exception") to an Errorpage.aspx. When I put the
    > error in a label I get the following :
    >
    > System.NotSupportedException: Inserting is not supported by
    > ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    > specified. at
    > System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
    > values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
    > DataSourceViewOperationCallback callback) at
    > System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
    > Boolean causesValidation) at
    > System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
    > causesValidation, String validationGroup) at
    > System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source,
    > EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    > EventArgs args) at
    > System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
    > EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    > EventArgs args) at
    > System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
    > System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
    > eventArgument) at
    > System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    > eventArgument) at
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
    > String eventArgument) at
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >
    > This is way to much ... I want just this :
    >
    > System.NotSupportedException: Inserting is not supported by
    > ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    > specified.
    >
    > Is that possible ?
    >
    > Thanks for any help on this,
    >
    > Benny
    >
    BenCoo, Apr 29, 2007
    #4
  5. Re: Exceptionhandling & errormessage - Codesnippped

    I'm not sure if you solved this problem already but this code does not
    indicate the error that you are getting, specifically what are you doing
    with 'objDsrLocationEdit' ?

    --
    Regards,
    Alvin Bruney
    ------------------------------------------------------
    Shameless author plug
    Excel Services for .NET is coming...
    OWC Black book on Amazon and
    www.lulu.com/owc
    Professional VSTO 2005 - Wrox/Wiley


    "BenCoo" <> wrote in message
    news:WF2Zh.147782$-ops.be...
    > Hi,
    >
    > In the page where I put the exceptionhandling I have the following code:
    >
    >
    > Protected Sub Page_Error(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Me.Error
    > Dim ex As Exception
    > ex = Server.GetLastError
    > Session("Exception") = ex.ToString
    > Response.Redirect("ErrorPage.aspx")
    > End Sub
    >
    > And in the ErrorPage.aspx
    >
    > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Me.Load
    > If Not IsPostBack Then
    > Me.lblError.Text = Session("Exception")
    > Session.Remove("Exception")
    > End If
    > End Sub
    >
    > Thanks !
    >
    > "BenCoo" <> schreef in bericht
    > news:UCNYh.146323$-ops.be...
    >> Hi,
    >>
    >> In my ASP.NET application I do some exceptionhandling and redirect the
    >> exception with Session("Exception") to an Errorpage.aspx. When I put the
    >> error in a label I get the following :
    >>
    >> System.NotSupportedException: Inserting is not supported by
    >> ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    >> specified. at
    >> System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
    >> values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
    >> DataSourceViewOperationCallback callback) at
    >> System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
    >> Boolean causesValidation) at
    >> System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
    >> causesValidation, String validationGroup) at
    >> System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source,
    >> EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    >> EventArgs args) at
    >> System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
    >> EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    >> EventArgs args) at
    >> System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
    >> System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
    >> eventArgument) at
    >> System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    >> eventArgument) at
    >> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    >> sourceControl, String eventArgument) at
    >> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
    >> System.Web.UI.Page.ProcessRequestMain(Boolean
    >> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >>
    >> This is way to much ... I want just this :
    >>
    >> System.NotSupportedException: Inserting is not supported by
    >> ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    >> specified.
    >>
    >> Is that possible ?
    >>
    >> Thanks for any help on this,
    >>
    >> Benny
    >>

    >
    >
    Alvin Bruney [MVP], Apr 30, 2007
    #5
  6. BenCoo

    BenCoo Guest

    Re: Exceptionhandling & errormessage - Codesnippped

    I call the objDsrLocationInsert from within the objDsrLocation object (type
    ObjectDataSource) It is normal that I get this error while I don't have
    written the Insert methode yet. I get simular error messages for the Update
    and Delete method while they are also not written yet.

    The only thing is, I just want to have a smaller error message as shown
    belllow. Something like this:

    System.NotSupportedException: Inserting is not supported by
    ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is pecified.

    This is the realy error description I think, the rest is added by the
    debuger and I don't want that in my label (is not of importance) in the GUI.

    Regards,

    Benny

    "Alvin Bruney [MVP]" <some guy without an email address> schreef in bericht
    news:...
    > I'm not sure if you solved this problem already but this code does not
    > indicate the error that you are getting, specifically what are you doing
    > with 'objDsrLocationEdit' ?
    >
    > --
    > Regards,
    > Alvin Bruney
    > ------------------------------------------------------
    > Shameless author plug
    > Excel Services for .NET is coming...
    > OWC Black book on Amazon and
    > www.lulu.com/owc
    > Professional VSTO 2005 - Wrox/Wiley
    >
    >
    > "BenCoo" <> wrote in message
    > news:WF2Zh.147782$-ops.be...
    >> Hi,
    >>
    >> In the page where I put the exceptionhandling I have the following code:
    >>
    >>
    >> Protected Sub Page_Error(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Me.Error
    >> Dim ex As Exception
    >> ex = Server.GetLastError
    >> Session("Exception") = ex.ToString
    >> Response.Redirect("ErrorPage.aspx")
    >> End Sub
    >>
    >> And in the ErrorPage.aspx
    >>
    >> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Me.Load
    >> If Not IsPostBack Then
    >> Me.lblError.Text = Session("Exception")
    >> Session.Remove("Exception")
    >> End If
    >> End Sub
    >>
    >> Thanks !
    >>
    >> "BenCoo" <> schreef in bericht
    >> news:UCNYh.146323$-ops.be...
    >>> Hi,
    >>>
    >>> In my ASP.NET application I do some exceptionhandling and redirect the
    >>> exception with Session("Exception") to an Errorpage.aspx. When I put the
    >>> error in a label I get the following :
    >>>
    >>> System.NotSupportedException: Inserting is not supported by
    >>> ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    >>> specified. at
    >>> System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
    >>> values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
    >>> DataSourceViewOperationCallback callback) at
    >>> System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
    >>> Boolean causesValidation) at
    >>> System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
    >>> causesValidation, String validationGroup) at
    >>> System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source,
    >>> EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    >>> EventArgs args) at
    >>> System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
    >>> EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
    >>> EventArgs args) at
    >>> System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
    >>> System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
    >>> eventArgument) at
    >>> System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    >>> eventArgument) at
    >>> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    >>> sourceControl, String eventArgument) at
    >>> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
    >>> System.Web.UI.Page.ProcessRequestMain(Boolean
    >>> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >>>
    >>> This is way to much ... I want just this :
    >>>
    >>> System.NotSupportedException: Inserting is not supported by
    >>> ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is
    >>> specified.
    >>>
    >>> Is that possible ?
    >>>
    >>> Thanks for any help on this,
    >>>
    >>> Benny
    >>>

    >>
    >>

    >
    >
    BenCoo, Apr 30, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kenny

    ErrorMessage

    Kenny, Jul 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    481
    David Waz...
    Jul 6, 2003
  2. Edmilson

    Errormessage in CustomValidator

    Edmilson, Jul 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    377
    Edmilson
    Jul 10, 2003
  3. Arjen
    Replies:
    2
    Views:
    336
    Michal A. Valasek
    Aug 2, 2003
  4. =?Utf-8?B?RG9ydGU=?=

    Reset errormessage on CustomValidator

    =?Utf-8?B?RG9ydGU=?=, May 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    =?Utf-8?B?RG9ydGU=?=
    May 7, 2004
  5. Joergen Vig

    Exceptionhandling in statemachine

    Joergen Vig, Jan 24, 2004, in forum: Javascript
    Replies:
    1
    Views:
    89
    Lasse Reichstein Nielsen
    Jan 24, 2004
Loading...

Share This Page