|
Thank you very much, that is what I was looking for, strange I couldnt find it myself :-|
Best regard,
Pawel
|
|
|
|
|
Hi,
My client requires the ability to download files from a remote Web server to up to 30 individual client desktop/laptop machines which could be any where in the country. A similar uploading requirement is also being requested.
To understand the WebRequest/Stream issues/handling in C# I have written a standalone Windows Application that successfully streams both data and files from the server that can be saved to the clients hard disk and used as required. I have also produced code that does the uploading process as well.
However all of these are driven from the client machine, ie: the user clicks a button on a client machine, a connection is made with the server and the upload/download process occurs once complete the client closes the connection. I am now moving this process on to use WebServices.
My question is this can WebApplications/WebServices be integrated/designed to allow the following scenario when downloading a file to the client:
1. User browses web pages on normal web site.
2. User sees file they wish to download to their OWN client machine.
3. User clicks link that finds file on server.
4. File streamed into suitable format.
5. Web server then either (i) calls local Web service running on its own machine and this web service is then able to contact the CORRECT client machine to stream the file/data to. Finally the web service on the web server closes the connection with the client. Or (ii) web server is able to call the client machine direct and stream the data/file etc...
[ Note: The upload process will still be driven by the client ]
Can any one advise whether this is possible with .NET..., any issues involved and possible examples/starting points.
I Have asked this on another newsgroup and not received an answer suggesting this is not possible.
Thanks in advance
Andrew
|
|
|
|
|
1-4 are standard procedures involved in downloading a file from a website.
As for #5, it doesn't work that way. It is the client that initiates contact with the server. After all how would the server know which of the millions of machines on the net to connect to?
|
|
|
|
|
Just as always, if this has already been discussed, just point me in the right diirection.
Whenever I try to do my file IO (for any program I've ever done), it turns out that I can also just open up the files in notepad and see (and edit) the contents just fine. I would like help in figuring out how to make my files not human-readable when opened in Notepad. I want to make it so that a user must use my program to modify the files it creates (to ensure the file obeys my file specs).
I'm familiar with the basics of file IO (I generally use StreamReader/ReadLine and StreamWriter/Write for ease and convenience), but I guarantee there are a few people on this forum that know a lot more than me!
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
You can use BinaryFormatter to change from your object to binary file.
Or if you want to create the file / format of your own, then
use BinaryWriter or BinaryReader.
Or if you want to take the best way is to encrypt the file.
See this one:
http://www.codeproject.com/dotnet/CryptoLib.asp
After you create your file, you must encrypt it.
If you want to open it, then first decrypt then open.
|
|
|
|
|
Hashing of the file is a good way to quickly check for changes.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I'm not sure what checking for changes would do for me. I already do that in the GUI. What I'm looking for is a way to write out the contents of the file so that it can't be read/edited in Notepad (at least, not without hosing it). You know, like when you rename an exe to txt and look at it in Notepad? Or, when you open an xls file in Notepad? I want my plain-text file to look like that goble-dee-guke, instead of looking like readable text.
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
When your file is in binary format there is no quick way to validate that it is indeed accurate. Your application could execute assuming correct data. Having the hash will allow you to verify that if the file was changed at least it was changed by some one with enough knowledge to recompute the hash correctly. In a robust system knowledge of errors is half of the problem.
I don't understand what is not to be impressed about RE Binary Readers and Writers, however. They seem like fairly simple to use streams.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I think I remember trying BinaryWriter and BinaryReader and not being impressed... maybe it has to do with what flavor of Write() I was calling...
I'll look deeper into BinaryWriter/Reader, and I'll look into what BinaryFormatter would do for me...
As far as encryption, I didn't want to go that far.
Thanks for the tips!
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Encryption is the best way. There are a lot of ways to do it. Also you may store a checksum at the end of the file and verify if the file was modified using checksum.
The BinaryWriter/BinaryReader option don't like me. It's not very safe.
I'm on a Fuzzy State: Between 0 an 1
|
|
|
|
|
Hi All,
I'm currently designing an "n tier" app to help manage my company's functions (incidentally, if you're wondering why they let a n00b like me at a project like this, there's only 5 of us and I once saw a computer back in 1985 )
I've broken it down into three layers, as per the advice from various guru's hither and thither: the data layer, the business logic layer and the client layer.
Now the data layer and client layer are within my experience - the data sits on a SQL Server server and the client layer is the app I write for the users.
Where I come unstuck is with the BLL. Where on earth should this go? On the ASP.Net forums I read an article about how you should implement the BLL as a serperate Class Library project (my app will be Win forms, but hopefully having a BLL gives me the option of doing some web stuff later if I can be bothered). All well and good so far...
...but where do you put this class library once it's finished? Distributing it with the client app seems a bit pointless, as any updates mean users have to reinsatll or whatever. This leads me to the conclusion I need to put it on a server soemwhere: but if I do this, how do I make the client app aware that it should be referencing these dll's? Can I just add them as project references and let .net handle the location when the app is distributed? Do I need to implement the whole BLL as a webservice? Also, as for performance, if the BLL is located on another computer, does this mean that it executes on the server, or is it downloaded and run on the client?
Any tips, articles, guides appreciated
|
|
|
|
|
Web services have provided the best abstraction for middle-tier architecture that I have seen. Depending on the number of users and the difficulty up updating you may be able to get away with your middle-tier class library existing on client machines (poor man's 3 tier apps)
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
If you are using .NET 2.0 you have the option to distribute your app using ClickOnce. This would give the best of best worlds sort of. The app lives and breaths on the client but updates are available on a server.
Web Services are also a good idea but you have to consider the usage of the app and frequency of updates. Obviously if you only plan to update your app once a year ditributing a new version with the latest code isn't to much of hassle, relatively speaking. On the other hand if your app may need to work in a disconnected or limited connection environment then WebServices wouldn't work.
|
|
|
|
|
Okay I have this Interface:
interface myInterface
{
public void visible(bool view);
}
I was implementing the visible method in my other classes like this:
visible(bool view)
{
if(view)
{
this.Left = -500000;
blah blah blah
}
else
{
this.left = 0;
blah blah blah
}
}
Okay I need to change my interface to an abstract class, so i can just implement the visible method one time in the abstract, but i can't use "this.Left" in the abstract because it doesnt contain a method for "Left".
It is probably a simple solution to this but how do I get this.Left, this.dock etc. to be available for use in my abstract class?
|
|
|
|
|
Make an abstract property get-set called Left which the derived classes override.
:josh:
My WPF Blog[^]
|
|
|
|
|
further to Josh's suggestion, the point of an abstract class is to abstract the functionality (as the name implies). Something like this would satisfy
public abstract class AbstractThing : myInterface
{
protected abstract void SetVisible();
protected abstract void SetInvisible();
public void Visible(bool view)
{
if(view)
SetVisible();
else
SetInvisible();
}
}
then your derived class, which has the Left property defined.
public DerivedThing : AbstractThing
{
protected override void SetInvisible(){ this.Left = -50000; }
protected override void SetVisible(){ this.Left = 0; }
}
or say you derive it and you wantr different behaviour for SetVisible and SetInvisible..eg/
public OtherDerivedThing : AbstractThing
{
protected override void SetInvisible(){ this.Visible= false; }
protected override void SetVisible(){ this.Visible = true; }
}
---
How to get answers to your questions[^]
-- modified at 10:36 Friday 14th July, 2006
|
|
|
|
|
Hi,
I have the following problem when trying to use Custom Controls published here at CodeProject with the full source code:
1.) I add the control source to my project
2.) Project compiles, everythings fine.
When I now want to add the control using the designer, I have to import it from the binary assembly the project has created ( so I'm referencing myself). Is there another way of registering in the toolbox just using the sourcecode ?
Its a bit annoying, because I get a warning that I'm using a different type. The most ExampleProjects have all integrated, but don't reference the outputbinary for having designer support.
I don't want to create a separate assembly containing all controls at the moment and I didn't found another solution yet.
Many thanks,
Florian
|
|
|
|
|
I think VS 2005 hadnles this issue better than VS 03. For VS2003 and if the control is inheriting from UserControl than double clicking it (so that the designer view pops up) then it should automatically being added to the toolbox.
|
|
|
|
|
Hi Robert,
if I click on the control sourcecode item ( e.g. Control.cs) i get a screen with the follwing text (window tab says "Control.cs [Design]":
To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create events for your class, click here to switch to code view.
Well, that pretty obvious, but I have no idea how to convince the toolbox when editing a form to display the control which is only existing in sourcecode at that moment. Ok, it seems that the Control I use is not inherited from UserControl, so it may not work here.
But you mean, if doubleclicking the sourcefile in the project should be enough if it is inherited from UserControl ?
Thanks,
Florian
|
|
|
|
|
Keep the control code seperate from your own. Make the control it's own seperate Project, then you can have it show up in the ToolBox.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Silly Question~
Which Component Reference do I need to use the StreamWriter Class?
Thanks in advance.
|
|
|
|
|
No reference needed.
Juz include
System.IO Namespace
|
|
|
|
|
Hi, all.
I'm trying to create an RFID application and related hardware using C# but couln't find any resource. Could anyone please tell me where I can learn about these stuffs. I've been searching for quite awhile but couldn't find it. When it comes to firmware programming, they mostly use C++, not C#. Please help.
KiT
|
|
|
|
|
Hi KiT,
do you want to program a firmware using C# or do you just want to acess functions using an existing SDK for your hardware ?
Firmware Programming using C# doesn't works at the moment I suppose, because you would need a CLR (common language runtime) for your desired microcontroller. But the most microcontrollers have a C/C++ compiler generating native code, which can be executed by them, so I suppose you have at the least to use C/C++, which is very common in the embedded world (despite a few native java processors).
Bye,
Florian
|
|
|
|
|
I see. Thank you very much, Florian. I've understood correctly that I intended to use only C# for embeded programming. But, aww... okay, I'll try C++ (I hate pointers -_-"). Thank you again for your help.
KiT
|
|
|
|