• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

response.redirect issue

Server: Win2003
IIS Ver: 6

Problem: Response.Redirect does not open VCS file.

Code:
____________________________________________________________________________
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=UTF-8" http-equiv=Content-Type>
<META content="MSHTML 5.00.3207.2500" name=GENERATOR></HEAD>
<BODY>

<FORM method=post action="testvcal.asp" name="VCal">
<pre>
<P align=center><FONT face=Verdana size=4>
    <STRONG>VCalendar Test Page</STRONG></FONT></P>
<%
    Dim DTStart, DTEnd, Subject, Location
    Dim Description, OutputFilePath
    Dim fMissingCriticalData, strMsg, Pass

      DTStart = Request.Form("DTStart")
      DTEnd = Request.Form("DTEnd")
      Subject = Request.Form("Subject")
      Location = Request.Form("Location")
      Description = Request.Form("Description")
      OutputFilePath = Request.Form("OutputFilePath")
      Pass = Request.Form("Pass")
      
    fMissingCriticalData=0
      strMsg = ""
   
    ' Put some default values in input boxes
      If Len(Subject) = 0 Then Subject = "Undetermined"
      If Len(Location) = 0 Then Location = "Undetermined"
      If Len(Description) = 0 Then Description = "Undetermined"
      If Len(OutputFilePath) = 0 Then  OutputFilePath ="C:\"
      If Len(Pass) = 0 Then Pass = 0

      If Pass > 0 Then
          If Len(DTStart)= 0 OR Not IsDate(DTStart) Then
            fMissingCriticalData=1
            strMsg = strMsg & "<Font color=red>Missing valid start date and time.</Font><BR>"
          End If
      
          If Len(DTEnd)= 0 OR Not IsDate(DTEnd) Then
            fMissingCriticalData=1
            strMsg = strMsg & "<Font color=red>Missing valid end date and time.</Font><BR>"
          End If
      
      Else
          strMsg = "<B>Provide the following information to create the appointment item.</b>"
      End If
      
      If fMissingCriticalData=1 or pass=0 Then
            Response.Write(strMsg)
%>
            <BR>
            <FONT face=Veranda size=3>
                  <INPUT id=txtPass name=Pass style="VISIBILITY: hidden" value="<%=Pass + 1%>">
                  
            <TABLE Border=0 align=center>
              <TBODY>
              <tr>
                 <td>Start Date and Time:</td>
                 <td><INPUT align=right id=txtDTStart name=DTStart value=<%=DTStart%>></td>
                 <td>(Format: mm/dd/yy hh:nn am/pm)</td>
              </tr>
              <tr>
                 <td>End Date and Time:</td>
                 <td><INPUT align=right id=txtDTEnd name=DTEnd value=<%=DTEnd%>></td>
                 <td>(Format: mm/dd/yy hh:nn am/pm)</td>
              </tr>
              <tr>
                 <td>Subject:</td>
                 <td><INPUT align=right id=txtSubject name=Subject value=<%=Subject%>></td>
                 <td></td>
              </tr>
              <tr>
                 <td>Location:</td>
                 <td><INPUT align=right id=txtLocation name=Location value=<%=Location%>></td>
                 <td></td>
              </tr>
              <tr>
                 <td>Description:</td>
                 <td><INPUT align=right id=txtDescription name=Description value=<%=Description%>></td>
                 <td></td>
              </tr>
              <tr>
                 <td>Output File Path:</td>
                 <td><INPUT align=right id=txtOutputFilePath name=OutputFilePath value=<%=OutputFilePath%>></td>
                 <td></td>
              </tr>
              <tr>
                 <td></td>
                 <td><INPUT id=submit1 name=submit1 type=submit value=Submit></td>
                 <td><INPUT id=reset1 name=reset1 type=reset value=Reset></td>
              </tr>

            </TBODY>
            </FONT>
            </TABLE>
        
<%

      Else
            If Len(Subject) = 0 Then Subject = "(No Subject Given)"
            If Len(Location) = 0 Then Location = "(No Location Given)"
            If Len(Description) = 0 Then Description = "(No Description Given)"
      
            Dim objVCal, VCalFile
            Set objVcal = Server.CreateObject("VCalWrap.ApptItem")

            With objVCal
                  .DTStart = DTStart
                  .DTEnd = DTEnd
                  .Subject = Subject
                  .Location = Location
                  .Description = Description
                  .OutputFilePath = OutputFilePath
                  .TimeZoneBias = -7
                  .CreateVCSEvent
                  VCalFile = .VCalFile
            End With
            Response.redirect(VCalFile)

      End If

%>
</Pre>
</FORM>
</BODY></HTML>
__________________________________________________________________________

Bottom line: Trying to get the VCalFile to open up once it is created. Ideas?
0
cjinsocal581
Asked:
cjinsocal581
  • 12
  • 6
  • 2
  • +1
1 Solution
 
cjinsocal581Author Commented:
If you want to run this, you will need the DLL from this site:

http://www.serverwatch.com/tutorials/article.php/10825_1475511_1
0
 
masirofCommented:
What is the error?
You have right permissions?
0
 
cjinsocal581Author Commented:
Response object error 'ASP 0158 : 80004005'

Missing URL

/calendar/testvcal.asp, line 119

A URL is required.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
aprestoCommented:
agreed, looks like VcalFile is not a valid URL, do a

response.write VCalFile

to see whats in it and post it here
0
 
cjinsocal581Author Commented:
Just produces a blank page.
0
 
masirofCommented:
Check properties of that redirected page. Check if that is the destination.
You may want to turn off friendly errors on advaced tab of internet option in IE.
Also please check source code.
Please let know if there anything.
0
 
cjinsocal581Author Commented:
It is not a page guys. It is a file that has been created. Please re-read through the entire code above.

I need it to pop my Outlook application when it is created as a VCS file. (Calendar item)
0
 
masirofCommented:
Can you open created by doulbe-clicking on it?
0
 
cjinsocal581Author Commented:
Yes I can, but the issue is getting it to open once it is created from the page. My users will not have access to the directory where the VCS files are being created.
0
 
masirofCommented:
Ok,
To do this you have to force download, meaning showing up a download dialog box, right?
Change headers, and you should be able doing it.
0
 
AlfaNoMoreCommented:
Something probably like this:

          If Len(Subject) = 0 Then Subject = "(No Subject Given)"
          If Len(Location) = 0 Then Location = "(No Location Given)"
          If Len(Description) = 0 Then Description = "(No Description Given)"
     
          Dim objVCal, VCalFile
          Set objVcal = Server.CreateObject("VCalWrap.ApptItem")

          With objVCal
               .DTStart = DTStart
               .DTEnd = DTEnd
               .Subject = Subject
               .Location = Location
               .Description = Description
               .OutputFilePath = OutputFilePath
               .TimeZoneBias = -7
               .CreateVCSEvent
               VCalFile = .VCalFile
          End With

          Response.ContentType = "application/" & file_type
          'Response.AddHeader "Content-Disposition", "attachment; filename=" & OutputFilePath
          Response.BinaryWrite(VCalFile)
0
 
cjinsocal581Author Commented:
We are getting closer.

It now pops up the dialog to download the file but the file it wants to download is the acutal asp page instead of the VCS file.

Ideas?
0
 
AlfaNoMoreCommented:
Sorry, you're going to need to uncomment the Response.Addheader line. Just noticed that!!!!
0
 
cjinsocal581Author Commented:
Ok, let me try.
0
 
cjinsocal581Author Commented:
This time I got the dialog box, but the file that was downloaded had this in it:
_________________________________________________________________________

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=UTF-16" http-equiv=Content-Type>
<META content="MSHTML 5.00.3207.2500" name=GENERATOR></HEAD>
<BODY>

<FORM method=post action="testvcal.asp" name="VCal">
<pre>
<P align=center><FONT face=Verdana size=4>
    <STRONG>VCalendar Test Page</STRONG></FONT></P>

</Pre>
</FORM>
</BODY></HTML>
_____________________________________________________________________
Any ideas?
0
 
masirofCommented:
Are you sure you are creating right type of file.
You said you are able to create file and open it by double clicking.

Issue is here, as I said before, to create right type of file, and force it for download using headers.
Please try.
0
 
cjinsocal581Author Commented:
This is the code I have in place:
___________________________________
   If Len(Subject) = 0 Then Subject = "(No Subject Given)"
          If Len(Location) = 0 Then Location = "(No Location Given)"
          If Len(Description) = 0 Then Description = "(No Description Given)"
     
          Dim objVCal, VCalFile
          Set objVcal = Server.CreateObject("VCalWrap.ApptItem")

          With objVCal
               .DTStart = DTStart
               .DTEnd = DTEnd
               .Subject = Subject
               .Location = Location
               .Description = Description
               .OutputFilePath = OutputFilePath
               .TimeZoneBias = -7
               .CreateVCSEvent
               VCalFile = .VCalFile
          End With

          Response.ContentType = "application/" & file_type
          'Response.AddHeader "Content-Disposition", "attachment; filename=" & OutputFilePath
          Response.BinaryWrite(VCalFile)
__________________________________________-

But it creates the asp file. Not the VCS, what am I missing?
0
 
masirofCommented:
You mean its extension is .ASP?
Extension should be VCS's extension.
0
 
cjinsocal581Author Commented:
sorry,

there is no extension on the file when it is prompted to be downloaded.

So, when I download it and open it with notepad, the asp page code is there, not the VCS code. (Asp page without the VBScript syntax of course)
0
 
cjinsocal581Author Commented:
This is what is in the file:
_________________________________________________________________________

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=UTF-16" http-equiv=Content-Type>
<META content="MSHTML 5.00.3207.2500" name=GENERATOR></HEAD>
<BODY>

<FORM method=post action="testvcal.asp" name="VCal">
<pre>
<P align=center><FONT face=Verdana size=4>
    <STRONG>VCalendar Test Page</STRONG></FONT></P>

</Pre>
</FORM>
</BODY></HTML>
_____________________________________________________________________
0
 
cjinsocal581Author Commented:
I figured it out. I just needed to point to the different file.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 12
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now