0

For the site I am running (which is now all html) they have a few old .aspx pages on there. A crawler has just complained there is a 5XX error on page index.aspx. There are possibly other external sites that link to this very old page - that is why it still remains.

The client does not want C# anymore on their site. I believe they want to move away from Windows servers in the near future. I want to rewrite this index.aspx file to redirect (permanently) to the new index.html.

I do not know enough about ASP.NET to know what to write in this old .aspx file to redirect it to the new index.html file.

I do not want any C# code. The client wants to move away from that. The client also wants a file based solution, no IIS.

Can I just write some html in this .aspx file, eg:

<html>
    <head>
        <meta http-equiv="refresh" content="0;url=new.aspx" />
    </head>
    <body>
    </body>
</html>

But hasn't W3C deprecated the use of the META element for refreshing or redirecting?

What is the new way of doing this in pure html that can be written in a aspx file without any C# compilation?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Rewind
  • 2,554
  • 3
  • 30
  • 56
  • This is not a duplicate of that question, as the html response says exactly what I said, saying W3C has deprecated it. So the question still stands. Please do not say it is a duplicate, when the answer to my specific question in that link is being named as a duplicate as I have clearly mentioned in my question. – Rewind Dec 13 '18 at 10:26
  • There are multiple answers in the duplicate. You can write C# code in an .aspx that issues a redirect. – CodeCaster Dec 13 '18 at 10:48
  • Again, please read my question. The client does not want any c# code on their site anymore. I believe they intend to move away from windows servers in the near future. – Rewind Dec 13 '18 at 12:09
  • Your requirements are unclear. Using the accepted suggestion from the duplicate, there's no compilation needed before deploy, IIS will compile the file on demand. If they move away from Windows servers, they can configure a redirect on their new webserver that if someone requests index.aspx, they get redirected to index.html. If you don't want _any_ C# code present anywhere, and don't want to use a meta refresh, then why don't you fix this with a redirect in IIS in the first place? Then you don't need any .aspx files at all. Just redirect index.aspx to index.html in IIS. See the second dupe. – CodeCaster Dec 13 '18 at 12:14
  • Again, the client wants the redirect in the file, no IIS. Sorry I did not make that clear. – Rewind Dec 13 '18 at 12:21
  • So you want to redirect from within a file, you don't want any serverside code, you don't want any serverside configuration, and you want it in plain HTML without meta refresh? You can't. You could using JavaScript. – CodeCaster Dec 13 '18 at 12:26
  • I am personally not opposed to html with meta refresh, but it appears that has been depricated (see the link they allege is a duplicate). If there is a javascript solution, I am happy with that, providing it is not depricated. However, strictly no c# and no IIS. – Rewind Dec 13 '18 at 13:45
  • At the moment I think it might be best to do it in the web.config file. How is this done? When they move the server to a non-windows one I can sort out the htacces. – Rewind Dec 13 '18 at 15:32

0 Answers0