OK, so the tear track to show images in a CR report on the Internet is as follows:
1) The following is assumed:
a) CR 2008 aka CR 12. I do not know about earlier versions, but XIR2 (11.5) can work.
b) Requires web-based image display in reports, with the development of a local workstation and preview
c) IIS, ASP.NET Application, .NET 4.0
d) Crystal Reports ( , , aspnet_client :
**system_web
4_0_30319
crystalreportviewers12**
.
-. - , ...
e) - , .
f) .
g) JPG, PNG BMP . AFAICT. , Word, PDF .., , . ...
h) , - -, -. , D:\MyDocuments
FTP, , , .
2) , -. , , , , 0: N , , . , , , . , , :
D:\MyDocuments\folderA\folder1\area51\whatever\myfile.png
, , , - .
3) D:\MyDocuments // . , .
4) , CR . () INI (ummm, OK) ( , ?) , (, - ?)
5) , , , N/ , (2) , , CR. - , , ....
6) a > BACK SLASHES . Shared StringVar FullQualifiedThumbnailFileName () , (4), Shared StringVar DocRoot () PLUS . , FullyQualifiedThumbnailFileName :
{@DocRoot} FolderLocationFromDB ThumbnailFileNameFromDB :
D:\MyDocuments\folderA\folder1\area51\whatever\tn_myfile.png
7) , . - , , . , REAL FullyQualifiedThumbnailFileName. , . -, .
8) , " ", "" .
, - , CR , -.
:
{@FullQualifiedThumbnailFileName} . - Windows DOS - .
9) , "file://". httpContext.Current.Session, . , .... WebURLRoot
10) txtImageURL. , , , ? - :
if lowercase( {@WebURLRoot} ) = "file://" THEN
{@WebURLRoot} &
REPLACE( {@txtDocumentFileFullyQualifiedName},"/","\")
else
URLENCODE( {@WebURLRoot} &
REPLACE(
{*DocumentFileNameFromYourSource*}
,"\","/") )
DocumentFileNameFromYourSource WebURLRoot , , DocRoot. . , , :
file:
. :
http://somewebhost/website/folderA/folder1/area51/whatever/myfile.png
http://localhost/website WebURLRoot. , -. , , , ?
{@txtImageURL} , , - . AKA - - .
txtImageURL . . URLEncode Crystal -.
txtImageURL , .
11) CR RPT
a) , Windows C:\MyDocuments, . , .
b) , ,
c) , Windows ,
d) URL -, :// http://localhost/website/at runtime -.
e) URL- , URL- -, .
? . , 2.
#
1) , , URL- - . Crystal Reports Viewer. , , , -, , Google, , . Global.asax.cs Session_Start, autover... , URL...:
string appPath = System.Web.HttpContext.Current.Request.ApplicationPath.ToLower();
if (appPath == "/")
appPath = "/";
else if (!appPath.EndsWith(@"/"))
appPath += @"/";
Session["APP_Path"] = appPath;
2) , , Session [ "APP_Path" ] :
if(! (HttpContext.Current.Session == null))
{
if (!(String.IsNullOrEmpty(HttpContext.Current.Session["APP_Path"].ToString())))
exporter.Arguments.Add(exporter.Arguments.Count, HttpContext.Current.Session["APP_Path"].ToString());
else
exporter.Arguments.Add(exporter.Arguments.Count, String.Empty);
}
. . , . - , , . . -, - , , - .
3) , , URL- - ://. , , -, - http://localhost/website/.
Gotchas:
1) . , , Windows/DOS, - Windows/DOS ://
.
2) .. , URL-...
3) , - Crystal, , . , DocRoot WebSiteRootURL, ( , ), , .
4) , . , Shared StringVar xyz. , (. 3 ). , , , , .
5) " " . , - , . , , , , .., , - . .
6) // DOS/Windows ( ). -, , , , , .
7) - , Junction Magic ~/MyDocuments D:\MyDocuments .. -, , , D:\MyDocuments, , -. , , , Virtual Directory - . , , - klutzy.
8) ? , . , IIS_IUSR , / ..
9) ? , , , SAP...
BLAST -
, -, Request URL- -. , .
, , , , CR OLE Windows... . .
, -, DOS/Windows, -, , . ~/Folder/Folder/File.png, , - - , , , , - , .
. .