cjinsocal581
asked on
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("OutputFilePa th")
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%>></t d>
<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("VCalW rap.ApptIt em")
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?
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("OutputFilePa
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%>></t
<td></td>
</tr>
<tr>
<td>Output File Path:</td>
<td><INPUT align=right id=txtOutputFilePath name=OutputFilePath value=<%=OutputFilePath%>>
<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("VCalW
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?
What is the error?
You have right permissions?
You have right permissions?
ASKER
Response object error 'ASP 0158 : 80004005'
Missing URL
/calendar/testvcal.asp, line 119
A URL is required.
Missing URL
/calendar/testvcal.asp, line 119
A URL is required.
agreed, looks like VcalFile is not a valid URL, do a
response.write VCalFile
to see whats in it and post it here
response.write VCalFile
to see whats in it and post it here
ASKER
Just produces a blank page.
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.
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.
ASKER
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)
I need it to pop my Outlook application when it is created as a VCS file. (Calendar item)
Can you open created by doulbe-clicking on it?
ASKER
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.
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
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?
Sorry, you're going to need to uncomment the Response.Addheader line. Just noticed that!!!!
ASKER
Ok, let me try.
ASKER
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?
__________________________
<!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?
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.
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.
ASKER
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("VCalW rap.ApptIt em")
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(VCalF ile)
__________________________ __________ ______-
But it creates the asp file. Not the VCS, what am I missing?
__________________________
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("VCalW
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(VCalF
__________________________
But it creates the asp file. Not the VCS, what am I missing?
You mean its extension is .ASP?
Extension should be VCS's extension.
Extension should be VCS's extension.
ASKER
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)
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)
ASKER
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>
__________________________ __________ __________ __________ __________ ___
__________________________
<!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>
__________________________
ASKER
I figured it out. I just needed to point to the different file.
ASKER
http://www.serverwatch.com/tutorials/article.php/10825_1475511_1