BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

URL mimetype and return?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker
View previous topic :: View next topic  
Author Message
Mark Tiede
Guest





PostPosted: Tue Feb 13, 2007 7:12 pm    Post subject: URL mimetype and return? Reply with quote



I have created a short cut to .URL file using IE by dragging the address bar
icon to the desktop. Then I moved this shortcut to my web app folder.

In my web app, I want to make a /OpenFile command with a parameter that
tells me an internal ID of that URL file. And when they do
/OpenFile?FILEID=6, I want my ISAPI app to go find the proper file and
return it so the browser opens that link in a new window. I have a href on
my main page that, when clicked, issues a JavaScript to call the following
function:

function openFile( FileID )
{
openWindow( "<#ScriptName>/OpenFile.URL?SID=<#SessID>&FileID=" +
FileID ,
"SiteWise", 800, 600, 0
);
}

function openWindow( URL, wndName, wndWidth, wndHeight, visible ) {
//center the window on the screen
var yPos = (screen.height / 2 ) - ( wndHeight / 2 );
var xPos = (screen.width / 2 ) - ( wndWidth / 2 );

open( URL,
wndName,
'toolbar=' + visible + ',' +
'scrollbars=' + visible + ',' +
'location=' + visible + ',' +
'status=' + visible + ',' +
'menubar=' + visible + ',' +
'resizable=yes,' +
'width=' + wndWidth + ',' +
'height=' + wndHeight + ',' +
'left=' + xPos + ',' +
'top=' + yPos );

}


When I run this, the hyperlink is recognized and the openFile function is
invoked which causes new ID window to open. But instead of the new window
going to the specified URL, it just shows the contents of the URL file.

Here is the essence of what the /OpenFile.URL does:

try
MS := TMemoryStream.Create;
FileStream := TFileStream.Create( <filenamehere>, fmOpenRead );
try

MS := TMemoryStream.Create;
MS.LoadFromStream( FileStream );
MS.Position := 0;
Response.ContentLength := MS.Size;
Response.ContentType := 'text/html';
Response.ContentStream := MS;

finally
FileStream.Free;
end;

except
on E : Exception do begin
...
end;
end;


I am guessing I am missing something basic, but I can't see what it is. Is
it the ContentType? Should I be somehow redirecting instead?
Back to top
Mark Tiede
Guest





PostPosted: Tue Feb 13, 2007 10:08 pm    Post subject: Re: URL mimetype and return? Reply with quote



I have solved part of my puzzle.

I ended up changing the mimetype to "text/x-url".

Now the next part of the trouble is the window it opened into.

I asked for a NEW window to be used for the URL. And the new window showed
up, with a dialog asking whether to Open or Save it. If I said Open, then
it did open. However the New window closed and the linked to address opened
up in the original window.

Does anyone know a way around this problem?

How can I keep it in the window it is being opened in?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.