Good day and welcome to the Microsoft QnA forums
Please do not use tags which has nothing to with the question. In one side you waste the time of good people that come here to help others on their free time. On the other side, you will not get the right answer or the fast answer if the right tag is not used.
Your question has nothing to do with SQL Server, but it has all to do with the web service/server.
How to redirect... in asp.net C#
The short answer: redirect using asp.net C# in the server side is done using the command Response.Redirect("http://ariely.info");
https://learn.microsoft.com/en-us/dotnet/api/system.web.httpresponse.redirect
But keep reading since there is a VERY good chance that you are thinking about a solution which is VERY wrong!
----------
image
(1) Web request Error 404 is not supposed to be an image but a web page (developed in HTML like most web pages).
If you see image then someone changed the configuration already - you need to speak to that someone who control your web server.
(2) It makes zero sense to redirect users to one big image instead of simple HTML page! HTML error page can be a few bytes, but you force your users to download an image of hundreds of kb. Is this makes sense you?!?
Error pages are simple HTML pages
How to redirect
(3) There are multiple ways to redirect a user which sent an HTTP request to specific URL. For example (and these are only few) all bellow solution works and are probably very bad solutions
- redirect the browser using meta tag
- redirect the browser using JavaScript command. To simulate a mouse click use the command
window.location.href = "http://ariely.info";
and to simulate an HTTP redirect (error 301) use the commandwindow.location.replace("http://ariely.info");
- redirect using asp.net C# in the server side is done using the command
Response.Redirect("http://ariely.info");
As mentioned, if you want to use error 404 then your basic approach is wrong. You should NOT redirect the user but present to him the error content, wherever he is.
Notice for example that if you go the following URL which does not exists https://ariely.info/NotRealPage
then your URL does not change. You are not redirected anywhere but simply get the error 404 - and notice that there is no image but the simplest page you can make.
Error 404 in the right way
Errors are managed by your web server in the server setting level.
If you are using Internet Information Services (IIS) - Microsoft web server, then the following document can help understand a bit more:
https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
You can use your customize error as explained in the documentation
Redirect old URL
If you really want to redirect specific URL (for example an old page which you deleted) then it is preferable (and it is the convention) for multiple reasons to redirect the URL using error 301 Redirect
rather than error 404.
Note! Error 404 means the URL was not found (was never exists). Error 301 means the URL moved to another place = redirected.
----------
I think I covered the most basic point :-)
If something is not clear then you can clarify a bit more about what is your exact needs and prefer procedure according this explanation.