we want to make a file cache for local internet provider (like squid).
Is it possible in C# to catch request for a file from user and send him local file instead of downloading it from remote server?
Thanks a lot!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Um, it depends upon what you mean by ‘catch a request’. You’re not talking about squid, are you? If so, problem solved :-).
Otherwise, if you are talking about catching requests that go through a specific web page, you could do it, but it would be pretty hairy. The idea would be to write an http handler that parses a webpage before it is served looking for links. If it finds one and has a local cache, you would re-write the link to point to your copy.
The other (um, better) alternative would be to parse for links when the pages are being created, which would save you a lot of processing power as the pages are being served. each link could be rewritten to pass through a proxy process that caches files and routes based upon its existence.
I told you it was hairy 🙂