Syntax Exception thrown when compiling expression RRS feed

  • Question

  • User1909155429 posted

       Can you please correct the following syntax.

    it throws an error stating expression expected at: new string('x',500)

    It is part of a example provided by Microsoft  ?

    Response.Redirect("NonexistentPage-NoCatch.aspx/" + new string('x',500))


    Saturday, July 26, 2014 8:46 AM


  • User2103319870 posted

    Replace the single quotes around x with double quotes.

    Change your code from 

    Response.Redirect("NonexistentPage-NoCatch.aspx/" + New String('x', 500))


    Response.Redirect("NonexistentPage-NoCatch.aspx/" + New String("x", 500))

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, July 26, 2014 8:56 AM