aspx file on server runs when accessed via https but not via http

Viewed 48

I have an aspx file on a Windows web server using IIS which performs as expected when accessed via https. However, when I access it via http from an iOS Swift 5 app being developed on a Mac, it returns the success code (200) but does not perform the required function. The web site has a URL rewrite rule implemented to convert http requests to https. I need to access the aspx via http to avoid using the encryption utilised by https, which requires additional work for it to be present in an iOS app. How can I make the aspx perform its function calling it using http?

The URL request is via http is http://xxxxx.com.au/Upload.aspx. The https request is https://xxxxx.com.au:82/Upload.aspx. The web site has an http binding to port 80 and an https binding to port 82.

The URL rewrite rule is

<rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
      <match url="(.*)" />
                <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />            
                </conditions>
              <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}:82/{R:1}" />
 </rule>

The aspx code is below

<%@ Import Namespace="System"%>
<%@ Import Namespace="System.IO"%>
<%@ Import Namespace="System.Net"%>
<%@ Import NameSpace="System.Web"%>

<Script language="C#" runat=server>
void Page_Load(object sender, EventArgs e) {
    
    foreach(string f in Request.Files.AllKeys) {
        HttpPostedFile file = Request.Files[f];
        string sFilePath = @"C:\inetpub\wwwroot\CaptionProWeb\" + file.FileName;
        if(System.IO.File.Exists(sFilePath)) System.IO.File.Delete(sFilePath);
        file.SaveAs(sFilePath);
    }   
}

</Script>
<html>
<body>
<p> Upload complete.  </p>
</body>
</html>
1 Answers

I sidestepped the problem by creating a new website bound only using http and placing upload.aspx in it. It then worked OK. I think the problem was caused by the URL rewrite rule. The fact that status 200 was returned even though upload.aspx did not perform was how I was misled.

Related