locked
url rewrite custom error page code behind RRS feed

  • Question

  • User1879965901 posted

    Hi Friends,

    I am using web.config urlrewrite custom error page.

    <httpErrors errorMode="Custom">
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
    </httpErrors>


    I have a button and label in error page(404.aspx)
    I need button click event in error page. But doesnot work code behind page.

    If url is domain.com/404.aspx its working. If use urlrewrite domain.com/test   (test area change all time in sql)  button click event dont work.

    Also i tried  Form.Action = "./404.aspx";

    Could anyone help me this topic?

    (Sory for my bad language).

    Thursday, December 15, 2016 10:13 AM

All replies

  • User-2057865890 posted

    Hi trumit,

    The URL can be absolute (for example, www.contoso.com/ErrorPage.htm) or relative. A relative URL, such as /ErrorPage.htm, is relative to the
    Web.config file that specified the URL for this attribute, not to the Web page in which the error occurred. A URL starting with a tilde (~),
    such as ~/ErrorPage.htm, indicates that the specified URL is relative to the root path of the application.

    Try

    ~/404.aspx

    Best Regards,

    Chris

    Friday, December 16, 2016 5:32 AM
  • User1879965901 posted

    Hi Zhao,

    Thanks for your response.

    404.aspx already displayed. But if i use urlrewrite(executeurl) , code behind doesnt work.

    (Button click send me different interesting url)

    How can ı use button change label click event in 404.aspx (with execure url) ?

    For example  domain.com/username

    Friday, December 16, 2016 12:39 PM
  • User-2057865890 posted

    Hi Trumit,

    Try using OnClientClick.

    https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick(v=vs.110).aspx

    Best Regards,

    Chris

    Wednesday, December 28, 2016 6:26 AM