If someone enters an invalid query string parameter to my web part, I want to respond with a 404 and redirect them my 404 page.
How can I do so?
I setup my web.config as:
<customErrors defaultRedirect="~/Special-Pages/Server-error.aspx" mode="On">
<error statusCode="404" redirect="~/CMSMessages/PageNotFound.aspx"/>
</customErrors>
When I use the API call RequestHelper.Respond404();, the page responds with a 404 status but does not send a redirect.
throw new HttpException(404, "Forum post not found"); sends the page to the ~/CMSMessages/PageNotFound.aspx?aspxerrorpath=/CMSPages/PortalTemplate.aspx: Page /CMSPages/PortalTemplate.aspx was not found.
How can I do so?
Thanks!
Joe Hoppe