PC Review


Reply
Thread Tools Rate Thread

calling a function without a page load event?

 
 
darrel
Guest
Posts: n/a
 
      4th Dec 2005
I'm storing data on all of the files we upload to our site in a database.

Instead of just linking directly to the file, I'd like to link to a page
that will then grab the file and update a count in the DB (for traching
which documents get the most downloads).

I could easily do this by sending the document link to a new URL, passing a
querystring, and have that page then stream the file.

Is there a way to do this without having to actually refresh the page in the
end-user's browser, though? I'm guess I'd have to use some compliled
server-side script for this outside of the current app?

-Darrel


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      5th Dec 2005
Try : http://support.microsoft.com/kb/260519/en-us

As the content is not to be displayed by the browser, the current window is
left intact (is this what you are looking for ?).

--
Patrice

"darrel" <(E-Mail Removed)> a écrit dans le message de
news:ewUtTXP%(E-Mail Removed)...
> I'm storing data on all of the files we upload to our site in a database.
>
> Instead of just linking directly to the file, I'd like to link to a page
> that will then grab the file and update a count in the DB (for traching
> which documents get the most downloads).
>
> I could easily do this by sending the document link to a new URL, passing

a
> querystring, and have that page then stream the file.
>
> Is there a way to do this without having to actually refresh the page in

the
> end-user's browser, though? I'm guess I'd have to use some compliled
> server-side script for this outside of the current app?
>
> -Darrel
>
>



 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      5th Dec 2005

> As the content is not to be displayed by the browser, the current window
> is
> left intact (is this what you are looking for ?).


Not quite. I think that would work if I am linking directly to the file. But
I'm not. And, the more I think about it, there probably isn't a way to do
what I want without a page load.

I was thinking of this process:

page: link -> downloadfile.aspx?file=fileX
downloadfile.aspx = adds a '1' to the file's download count and streams
fileX to the browser.

I was wondering if there was a way to get downloadfile.aspx to execute but
not actually load the page. But, the more I look at that, the more I realize
that that would be rather impossible. ;o)

-Darrel


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      6th Dec 2005
Still not sure what you are looking for... Have you checked this article ?
It doesn't do direct linking.

downloadfile.aspx executes and the page_load event is executed (this is not
a problem, this is just executes what you want server side) and the current
page is not replaced. Is this what you are looking for ?

If yes, it should definitely work. Show us the code (you perhaps forgot to
clear the HTML content or to use the proper headers so that the browser
understand that it should not display the content but raise the download
file dialog).


--
Patrice

"darrel" <(E-Mail Removed)> a écrit dans le message de
news:%23ZWuiYe%(E-Mail Removed)...
>
> > As the content is not to be displayed by the browser, the current window
> > is
> > left intact (is this what you are looking for ?).

>
> Not quite. I think that would work if I am linking directly to the file.

But
> I'm not. And, the more I think about it, there probably isn't a way to do
> what I want without a page load.
>
> I was thinking of this process:
>
> page: link -> downloadfile.aspx?file=fileX
> downloadfile.aspx = adds a '1' to the file's download count and streams
> fileX to the browser.
>
> I was wondering if there was a way to get downloadfile.aspx to execute

but
> not actually load the page. But, the more I look at that, the more I

realize
> that that would be rather impossible. ;o)
>
> -Darrel
>
>



 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      6th Dec 2005
> downloadfile.aspx executes and the page_load event is executed (this is
> not
> a problem, this is just executes what you want server side) and the
> current
> page is not replaced. Is this what you are looking for ?


Umm...yea, I think so, though I didn't quite get that from the article.

So, the page I link to that streams the file...the aspx page...that page
should have different headers?

-Darrel


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      7th Dec 2005
The page you use to stream the file uses a header that "tells" the browser
that this is NOT HTML content (but for example a "file attachment").

This way the browser :
- raises the "open/save as" dialog so that the user can open or save the
file on disk
- as the browser knows this is not HTML content (as it raises this dialog
instead), the browser has no reason to replace the current HTML page...

The article I mentionned earlier is for ASP but it applies as well to
ASP.NET as this is actually a client side issue (you just have server side
to send the proper HTTP header so that the browser reacts accordingly).

This is how it works...

--
Patrice

"darrel" <(E-Mail Removed)> a écrit dans le message de
news:unHdaGr%(E-Mail Removed)...
> > downloadfile.aspx executes and the page_load event is executed (this is
> > not
> > a problem, this is just executes what you want server side) and the
> > current
> > page is not replaced. Is this what you are looking for ?

>
> Umm...yea, I think so, though I didn't quite get that from the article.
>
> So, the page I link to that streams the file...the aspx page...that page
> should have different headers?
>
> -Darrel
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Javascript function upon Page Load from Page Load event handle Matcon Microsoft ASP .NET 3 28th May 2008 06:15 PM
Error when calling the On Load event of my subform HeislerKurt@gmail.com Microsoft Access Form Coding 2 10th Nov 2007 06:08 AM
calling event function Gunawan Microsoft ASP .NET 2 24th Aug 2006 04:37 AM
Calling an event procedure from page load =?Utf-8?B?SmFzb24=?= Microsoft ASP .NET 3 28th Dec 2005 09:38 AM
Form: calling Close() method in Load event. Qwert Microsoft VB .NET 6 2nd Mar 2005 05:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:18 PM.