locked
system.web.httpexception RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have written the below code . I am using c#

    catch (Exception ex)
    {
    Response.Write("<script language=""javascript"">")
    If ex.InnerException Is Nothing Then
    Response.Write("alert(""" + ex.Message.ToString() + """);")
    Else
    Response.Write("alert(""" + ex.InnerException.Message.ToString() + """);")
    End If
    Response.Write("</script>")

    }

    Thanks

    Thursday, June 21, 2018 9:31 AM

Answers

  • User632428103 posted

    Hello,

    i have just test in my machine, and this sample work of course it's on c#

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
    Response.Write("<script language='javascript'>alert('this is a sample');</script>");
    
                }
            }
    

    for me it's not c# it's vb ...did you meet a problem about the translate ? 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 21, 2018 9:53 AM

All replies

  • User632428103 posted

    Hello,

    i have just test in my machine, and this sample work of course it's on c#

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
    Response.Write("<script language='javascript'>alert('this is a sample');</script>");
    
                }
            }
    

    for me it's not c# it's vb ...did you meet a problem about the translate ? 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 21, 2018 9:53 AM
  • User475983607 posted

    Hi

      I have written the below code . I am using c#

    catch (Exception ex)
    {
    Response.Write("<script language=""javascript"">")
    If ex.InnerException Is Nothing Then
    Response.Write("alert(""" + ex.Message.ToString() + """);")
    Else
    Response.Write("alert(""" + ex.InnerException.Message.ToString() + """);")
    End If
    Response.Write("</script>")

    }

    Thanks

    Use the standard ASP script controls.

    https://msdn.microsoft.com/en-us/library/ms178207.aspx

    Thursday, June 21, 2018 9:58 AM