|
Thanks Pete,
for the sake of simplicity lets neglect time restriction. so here we only have the size as a criteria for dowload restriction.
for the complete dowloads I don't have any problem but somehow download process become aborted I should have the amount size of downloaded bits because this count towards my limit size.
|
|
|
|
|
With a simple database table and a simple query, you should be able to easily limit the user then. All you need do is track the amount of data downloaded against the user by time.
|
|
|
|
|
I know that. My problem here is that how can I figure out how many bits are downloaded.
I need a code snippet.
|
|
|
|
|
That really depends on how you are letting them download. If all you are doing is putting onto a response stream and letting them download that (and not worry if they abort out mid transfer), then you simply need to count the bytes you are pushing into the response stream. To be honest, this is probably your best bet as other methods become a lot more complicated.
|
|
|
|
|
|
No problem. Glad to help.
|
|
|
|
|
OK. You should have posted this in one location only. Please don't crosspost as it's rude.
|
|
|
|
|
We are creating a chat client application where we need to push messages to mobile clients.
No we have WCF service and client is requesting service every 3 minutes.
Is there a way we can use WCF to push data to clients over HTTP?
|
|
|
|
|
You need to probably take a look at Duplex Services - see this blog[^]. Apart from this you can read more about these type of services on msdn.
|
|
|
|
|
nitin_ion wrote: Is there a way we can use WCF to push data to clients over HTTP?
There is no way to push over HTTP full stop, never mind with WCF. HTTP is based on a request/response model so you can only send data in response to a request made by the client.
|
|
|
|
|
That's not entirely correct. It is possible to establish a polling duplex HTTP connection. You can find details here[^] on HTTP push.
|
|
|
|
|
Most of those are essentially faking a push. Re-using a connection would count but I didn't think the browser/service client would accept a second response within the same connection if it hadn't requested it.
|
|
|
|
|
And this is why I was careful to say a Duplex connection - so that the client knows that the response will be left open.
|
|
|
|
|
Push is evil, don't use it.
Always use polling.
|
|
|
|
|
Yep.
And like extra worse for a chat mobile application.
|
|
|
|
|
For a web service, yes. There are other scenarios where that's definitely not the case though (when the speed of update to clients is critical and the number of clients relatively low).
|
|
|
|
|
BobJanova wrote: There are other scenarios ...
Never for a "chat" service. That means humans. And with a low number even less point.
|
|
|
|
|
I'm writing a C# program that reads RSS feeds and displays them on a windows form... The program first worked fine, no problem, but suddenly it began to crash once I had navigated in the web browser control in the C# program. I got into some sort of knowing what causes the problem... When provide the web browser using WebBrowser.DocumentText = sting with large amount of data it does crash... so does anybody have a solution for that??
sb.Append("");
sb.Append(row.title);
sb.Append("
");
sb.Append(ASCIIEncoding.ASCII.GetString((byte[])row.desc));
desc_self_nav = false;
webBrsrRSSDesc.DocumentText = sb.ToString()
|
|
|
|
|
Is it the webbrowser that crashes, or the stringbuilder? Can you paste the text of the exception that it throws?
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: Is it the webbrowser that crashes, or the stringbuilder?
That's what the OP wants to know.
Eddy Vluggen wrote: Can you paste the text of the exception that it throws?
Obviously, if there was an exception, it would not be called a crash.
|
|
|
|
|
Shameel wrote: That's what the OP wants to know
Not so hard to find out, is it? Just put the contents of the StringBuilder in a (temp) string, and assign it to the browser on the second line.
Shameel wrote:
Obviously, if there was an exception, it would not be called a crash.
Thanks for the useful hint
Bastard Programmer from Hell
|
|
|
|
|
Shameel wrote: Obviously, if there was an exception, it would not be called a crash.
Not true. If he hasn't handled the exception it would still crash, but there would still be an exception.
|
|
|
|
|
Pete O'Hanlon wrote: but there would still be an exception.
Correct, but in case of a crash, the OP would not be able to post the exception here, and that is what I was pointing out to.
|
|
|
|
|
I'm pretty sure that an unhandled exception would be written to the event log if it crashed an application. It's been so long since I've written an application where I didn't have a top level exception handler, but I'm fairly certain this is the case.
|
|
|
|
|
Non curo; if he's working with computers, then he should be able to tell a bit more than "it crashed". Your basic helpdesk-employee will tell you that there are different kind of crashes - should I simply assume that it generated a BSOD?
Most people here are referring to "exceptions" when they're talking about code and "crash".
Bastard Programmer from Hell
|
|
|
|