|
Sorry, but you will have to follow the links in that blog for the information, this is not something I have used.
|
|
|
|
|
I am writing a C# application that can control, monitor and upgrade firmware on 3 different hardware products. These products are accessed through registers and every once in a while registers are made obsolete or added (at the end). In my C# application I have a table of the latest versions this version of the C# application supports, e.g.:
PRODUCT_0 3.0.2.8
PRODUCT_1 2.0.2.1
PRODUCT_2 4.4.2.0
If I try to communicate with a PRODUCT_1 of version 2.0.2.2 in the example above, my C# application would display an error message asking the user to obtain a newer version of the C# application.
I feel it would be nice to also give the actual C# application some kind of version or unique identifier. Of course, in the example above I could call it "version" 3.0.2.8 2.0.2.1 4.4.2.0, but as I add more products this "version" would become very long. I could use the same versioning format as the products (W.X.Y.Z), but is becomes difficult to manage when several persons work on separate branches on the different products in Git. I'm thinking that calculating a 4-byte CRC/hash on the supported versions would be a better option, but then I lose chronological information (it becomes hard to know which version is the latest version). So that would need to supplemented with a timestamp of some sort. Please note that I want the version/hash/time stamp to be compiled into the C# so it can be shown in a little "About"-box. Does anybody have any suggestions?
Another thing I was thinking of is to include the entire Visual Studio source code of my C# application project as a zip-file that can be downloaded from within my C# application by pressing a button "Get This Application's Source Code", that way I could always get the source code of an .exe file and then I could iterate through Git to find the most appropriate commit. Does anybody have experience with this and can share experiences?
|
|
|
|
|
I use a "minimum supported version" for new functionality. That version refers to the executable, which has it's build-number (part of the version) updated autmatically. When checking if something is available for the "current" version, I just check the first three and ignore the build altogether.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
arnold_w wrote: Please note that I want the version/hash/time stamp to be compiled into the C# so it can be shown in a little "About"-box.
You could use attributes for that matter. It would allow you to insert metadata in the executable about which version is supported for which product.
Attributes (C#)[^]
Then, you can either access this metadata at runtime using reflection (and format proper error messages, for example), or inspect the assembly with ildasm.exe and get these informations.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
This may help with some of it: Timestamping assemblies with Build date and time.[^] - the use of pre- and post- build events would also allow you to embed the zipped source code of your app in your app as a resource in much the same way.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I like the T4 Template solution proposed by Peter Taylor on SO:
c# - Displaying the build date - Stack Overflow[^]
There are also several other interesting approaches in that thread.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Team,
I am working to fix the issue of Cross Side Scripting-XSS in asp.net with C#. team is using the burp interceptor to inject the script like this %uff1cscript%uff1ealert%uff08123456%uff09%uff1c/script%uff1e but I am tried several ways to encode this text to find out the html but I am not able to do it tried antixss and html encode but its not working.
please let us know how to handle these codes to fix the issue
|
|
|
|
|
A way to manage this is by adding the content-security-policy response header. If your site only uses internal scripts, you would set the script-src to self . Now, what happens if you rely on cdn's? Fortunately, these can be whitelisted in the same header. Ultimately, you would end up building a response header that looks like this:
response.AddHeader("Content-Security-Policy",
"default-src https:; script-src 'self' https://stackpath.bootstrapcdn.com; style-src 'self' https://ajax.aspnetcdn.com");
|
|
|
|
|
Message Closed
modified 6-Nov-19 4:15am.
|
|
|
|
|
Short answer: Don't. The registry is not a good place to store application data. You should use a normal application repository in one of the AppData domains; see Where should I store my data?[^].
|
|
|
|
|
How to send sms to any mobile number through mobile connection c# why we buy api etc. i want to send sms through my mobile packages in c# code, HELP ...
|
|
|
|
|
Google will find you many articles on the subject.
|
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:15am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:15am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:14am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:14am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:14am.
|
|
|
|
|
Hi!
Long time lurker here with a question.
I am thinkig of making a software that temporarily disables windows from auto-running a application when inserting a cd or usb. To do this, I need to edit a key in the registry, that is no hard to do.
What I want to know if this is enughe to stop malware from getting on my pc if I insert a usb-drive or cd, or if I am still risking getting a virus/malware on my pc.
If I understand it enughe, for a virus or other malicius software to infect my pc, dosen't it have to run some kind of script or app for it?
Would doing the above prevent that from happening or is it still dangerus to insert unknown usb drives into my pc, even with the auto run feature turned off?
Have a nice day
Acuena
modified 1-Nov-19 18:40pm.
|
|
|
|
|
Disabling autoplay won't be enough to protect you from a malicious USB drive.
An attacker can manipulate the firmware[^] so that the drive pretends to be a keyboard or a network adapter. They can then send commands to your computer, or extract data, without having to run any software.
You can even purchase a "USB Killer" drive[^], which can completely destroy your hardware as soon as you plug it in.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ow ya, did not think about the USB-killers and the modified firmware thing. That makes it much more harder to protect against bad USB with a software, it would make it impossible for the USB killer part.
Guess you could protect against the USB-Killer attack by having a external device you can use as a sacrifice thing between the PC and the USB, it must be able to handle the surge though.
Guess we have to stick to not allow it then unfortunately.
|
|
|
|
|
To add to what Richard says, you get no real protection with a basic software solution: many computers are configured to allow "boot from USB" for recovery purposes, and even if disabling it in Windows works, if it has a bootable partition it stands a good chance of taking over the PC completely the next time it is turned on as that is part of the BIOS and before Windows even starts to load. The same problem exists with CD's (where fitted) - they can also be selected as a bootable device.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yes, this is another problem I did not think off. Thanks for that
|
|
|
|
|
You're welcome!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi
I'm new to C# and oop (though I have coded in Autoit for more that a decade, so I do have a basic understanding of coding) , I usually use google to get answers, but this question I haven't been able to find an answer to.
My problem/question.
I have created a simple form with 2 text boxes and a button. The form is in a class library, course I want to use it in several programs. In the same library I have another class file, that I want to handle all calls to my lib.
My problem is that I don't know how to "pop" the form, and how to use the button to get the input data from the text boxes, and then handle that data within my class file.
I want to use the library to handle the main programs license.
My idea is:
User launches the main program.
The program calls my license lib -> the lib checks if a license for the program exists in the database, if not "pop" the form to allow the user to enter User Name and License.
When the user clicks the form button, the lib calls a license server to check if the license is valid, if the lic is valid it writes it to the database, and shows a License is Valid message to the user.
Else if the license exist, continue the main program and drop the lic lib.
I hope that it clear what I try to achieve, and that some one can help point me in the right direction
Cheers
/LR
|
|
|
|