0

All of a sudden from the past few days we noticed that export to excel and word is not working in classic asp screens. There is no issue with the code to my knowledge. I think it is related to some security update by Microsoft or some other issue. Can any one help me with fixing this issue

Error:

This site can’t be reached

The webpage at /Common/PtSchNoShowsExportToFile.asp?txtFromDt=12/08/2019&txtToDt=01/08/2020&appl=vnd.ms-excel&type=NoShow might be temporarily down or it may have moved permanently to a new web address.

ERR_INVALID_RESPONSE

Code:

<%@ Language=VBScript %>
<%Response.expires = -1%>
<%
     'Change HTML header to specify Excel's MIME content type
     Response.Buffer = TRUE 
     Response.ContentType = "application/" & request("appl")

    dim filename
    filename = "No Show Report.xls"
    filename = Replace(filename, " ", "%20")
    Response.AddHeader "Content-Disposition", "attachment;filename="&filename

Function FormatDate(strDate)
        dim arrDate
        dim length
         
      if (strDate=null) then
          FormatDate=strDate
      else
          arrDate=Split(strDate,"/")
          length=UBound(arrDate)
          if(length>1) then
                if(len(arrDate(0))=1) then
                    arrDate(0)="0" + arrDate(0)
                end if
                if(len(arrDate(1))=1) then
                    arrDate(1)="0" + arrDate(1)
                end if
                FormatDate=arrDate(0) +"/" + arrDate(1) + "/" + arrDate(2)
           else
                FormatDate=strDate
            end if
       end if     
     
  End Function
%>
<HTML>
<body>
<% 
   '--Connection String
   set Cnn = server.CreateObject("ADODB.connection")
   Cnn.ConnectionString = Application("MyConnectionStringGoesHere")
   Cnn.open    

   set rs = Cnn.Execute("Sp_Report_ScheduleV4_NoShows @StartDate='" & request("txtFromDt") & "',@EndDate='" & request("txtToDt") & "'")

%>
<TABLE WIDTH = 75% BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR>
    <TD><font size=+2>Provider</TD>
    <TD><font size=+2>Date & Time</TD>
    <TD><font size=+2>Day</TD>
    <TD><font size=+2>Site</TD>
    <TD><font size=+2>Reason</TD>
    <TD><font size=+2>Chart</TD>
    <TD><font size=+2>Name</TD>
    <TD><font size=+2>Type</TD>
    <TD><font size=+2>Home#</TD>  
    <TD><font size=+2>work#</TD>    
    <TD><font size=+2>Cancel Reason</TD>
</TR>
<% Do while not rs.EOF %>
<TR>
    <TD><%=trim(rs("ProvName"))%></TD>
    <TD><%=FormatDate(rs("AppSDate"))%></TD>
    <TD><%=weekdayName(rs("DOW"),true)%></TD>
    <TD><%=trim(rs("LocCity"))%></TD>   
    <TD><%=rs("Reason")%></TD> 
    <TD><%=rs("pt_id")%></TD>   
    <TD><%=rs("ptName")%></TD>   
    <TD><%=rs("Type")%></TD>   
    <TD><%=rs("PtHomePhone")%></TD>   
    <TD><%=rs("PtWorkPhone")%></TD>   
    <TD><%=rs("CancelReason")%></TD>
</TR>
<%
        rs.MoveNext
   Loop
   rs.Close
   set rs = Nothing         
%>
</TABLE>
</BODY>
</HTML>
Community
  • 1
  • 1
Shrinivas
  • 65
  • 1
  • 11
  • 1
    First, you need to [enable detailed error messages in Classic ASP](https://stackoverflow.com/a/2640607/692942) so you get something more meaningful than "This site can’t be reached". Once you have done that, [edit] the question and add the actual error. – user692942 Jan 09 '20 at 08:27
  • 1
    Thanks a lot @Lankymart, i found that the column CancelReason was not part of stored procedure which was used for pulling the report. – Shrinivas Jan 09 '20 at 16:09

0 Answers0