Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Directory at the Web Server

Status
Not open for further replies.
Oct 11, 2006
300
US
Is it necessary for all the reports and ASP files to reside in the same directory?

For convenience, I would like my Crystal Reports in one folder while the ASP pages in another folder

How can I do this, if possible?

Thanks.
 
Hi,
As long as you can reference the path to where the reports are located when creating the new ReportObject, it should not matter.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Where do I mention the path in my ASP pages? I do not want to touch the ASP sample files -

AllMyRequiredSteps.asp
rptserver.asp
cleanup.asp
MoreRequiredSteps.asp
SmartViewerActiveX.asp

All my files are within the directory
while my ASP files lie in the folder.

Thanks.
 
Hi, It is in the AlwaysRequired ,in this section:

Code:
' CREATE THE APPLICATION OBJECT                                                                     
If Not IsObject (session("oApp")) Then                              
  Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
End If                                                               

'This "if/end if" structure is used to create the Crystal Reports Application
'object only once per session.  Creating the application object - session("oApp")
'loads the Crystal Report Design Component automation server (craxdrt.dll) into memory.
'
'We create it as a session variable in order to use it for the duration of the
'ASP session.  This is to eliminate the overhead of loading and unloading the
'craxdrt.dll in and out of memory.  Once the application object is created in
'memory for this session, you can run many reports without having to recreate it.
                                                                      
' CREATE THE REPORT OBJECT                                     
'                                                                     
'The Report object is created by calling the Application object's OpenReport method.
[COLOR=red]
>>>>>>>>>>>>>>>>>>>>>Use explicit Path location not Request Server Variables>>>>>>>>>>>>
Path = Request.ServerVariables("PATH_TRANSLATED")                     
While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      
iLen = Len(Path) - 1                                                  
Path = Left(Path, iLen)                                               
Wend                                                        [/color]          
                                                                      
'This "While/Wend" loop is used to determine the physical path (eg: C:\) to the 
'Crystal Report file by translating the URL virtual path (eg: [URL unfurl="true"]http://Domain/Dir)[/URL]                                                                        

'OPEN THE REPORT (but destroy any previous one first)                                                     

If IsObject(session("oRpt")) then
	Set session("oRpt") = nothing
End if

On error resume next

Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)
'This line uses the "PATH" and "reportname" variables to reference the Crystal
'Report file, and open it up for processing.

If Err.Number <> 0 Then
  Response.Write "Error Occurred creating Report Object: " & Err.Description
  Set Session("oRpt") = nothing
  Set Session("oApp") = nothing
  Session.Abandon
  Response.End
End If

'This On error resume next block checks for any errors on creating the report object.
'We are specifically trapping for an error if we try to surpass the maximum concurrent
'users defined by the license agreement.


Supply the Path and the reportname whete needed.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
So would this suffice:

'Path = Request.ServerVariables"PATH_TRANSLATED")
Code:
Path = "[URL unfurl="true"]wwwroot\reports\"[/URL] 
While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      
iLen = Len(Path) - 1                                                  
Path = Left(Path, iLen)                                               
Wend   [\code]
 
Hi,
Don't know for sure..try testing it..

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top