|
I'm back with another question regarding some PHP code I converted to C#.
The PHP code uses OpenSSL to verify a signature (it's a string of characters, as opposed to being attached to a file). I have the public and private keys.
Can I use the crypto stuff built into .net to verify the signature, and if so, can someone point me to a place that describes how I would go about doing so?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I am going to develop a C# windows application and deploy in a server. This exe file will be used by around 10 people at the same time. I think it will create new instances for each user.
What I want to know is, are there any know issues for these kind of scenarios? What the general good practices for this kind of application?
Thanks & Regards
|
|
|
|
|
We use the same approach in one of our projects with no issues.
The reason is that you have only one exe but a process of its own per user.
But of course, if you are accessing any ressources (files, devices, ...) then you have to do it in a thread-safe manner.
Happy programming
Urs
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Can somebody guide about conditional compiler directives in .NET whereby I should be able to have a particular snippet visible only to 1.1 Compiler and a certain section only for 2.0 compiler.
Basically, I am trying to see an elegant way in which if had put a code for 1.1 and when the application is brought into 2.0, instead of just keeping it commented, we can have elegantly toggle between the versions.
|
|
|
|
|
Unfortunately, there are no built in conditional symbols for this. You will need to define your own in the project properties, under the Build tab. Add the comditional symbol you want to the "Conditional compilation symbols" text box (multiple symbols must be space separated).
Once you do that, you can wrap the code in #if [symbol] blocks. It would look like this (assuming you define a symbol named NET_20):
#if NET_20
#else
#endif
|
|
|
|
|
Thank you Scott. Let me give it a try.
|
|
|
|
|
No problem. Hope it works for you.
|
|
|
|
|
Hi,
I have a similar approach, defining one symbol at the project level, then
adding the following at the start of interested files:
#if !NET11 && !NET20
#error "Missing version of .NET Framework (define one of NET11, NET20)"
#endif
BTW: I use two different symbols, not the #else part Scott suggested; when a third
version will be required, the code will fail unless reworked and not fall back silently
to one or the other.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: I use two different symbols, not the #else part Scott suggested; when a third
version will be required, the code will fail unless reworked and not fall back silently
to one or the other.
That's a good point. Defining multiple symbols and using a check like you show is definately the safest approach.
|
|
|
|
|
Sounds like a language-specific question to me.
|
|
|
|
|
Can't get you. Actually, that would decide which functions to use. Isn't it?
|
|
|
|
|
Hi,
I have a really simple data contract in my WCF service:
<br />
Namespace CTPInfoData<br />
<DataContract()> _<br />
Public Class myInfo<br />
<br />
<DataMember()> _<br />
Public Name As String<br />
<br />
<DataMember()> _<br />
Public Allowed As Boolean<br />
<br />
End Class<br />
End Namespace<br />
<br />
Namespace CTPInfoCtrlns<br />
<ServiceContract()> _<br />
Public Interface IInfoCtrl<br />
<OperationContract()> _<br />
Function SetName(ByVal Info As CTPInfoData.myInfo) As Boolean<br />
End Interface<br />
<br />
Public Class CTPInfoCtrl<br />
Implements IInfoCtrl<br />
<br />
Public Function SetName(ByVal Info As CTPInfoData.myInfo) As Boolean Implements IInfoCtrl.SetName<br />
If Info.Allowed Then<br />
If Info.Name = "Bert" Then<br />
Return True<br />
Else<br />
Return False<br />
End If<br />
Else<br />
Return False<br />
End If<br />
End Function<br />
End Class<br />
End Namespace<br />
<br />
Module Module1<br />
<br />
Sub Main()<br />
Dim baseuri As New Uri("http://127.0.0.1:8027/")<br />
Dim host As ServiceHost = New ServiceHost(GetType(CTPInfoCtrlns.CTPInfoCtrl), baseuri)<br />
<br />
Dim metadata As ServiceMetadataBehavior = host.Description.Behaviors.Find(Of ServiceMetadataBehavior)()<br />
If metadata Is Nothing Then<br />
metadata = New ServiceMetadataBehavior<br />
metadata.HttpGetEnabled = True<br />
host.Description.Behaviors.Add(metadata)<br />
Else<br />
metadata.HttpGetEnabled = True<br />
End If<br />
<br />
Dim bind As Binding = New BasicHttpBinding()<br />
host.AddServiceEndpoint(GetType(CTPInfoCtrlns.IInfoCtrl), bind, "http://127.0.0.1:8027/CTPInfo")<br />
<br />
host.Open()<br />
Console.WriteLine("Running service....press any key to terminate")<br />
Console.ReadKey()<br />
<br />
End Sub<br />
<br />
End Module<br />
But my test client doesn't seem to pass the data contract through to the service:-
<br />
Sub Main()<br />
<br />
Dim bind As New BasicHttpBinding()<br />
Dim endpoint As New EndpointAddress("http://127.0.0.1:8027/CTPInfo")<br />
Dim ctrl As New InfoCtrlClient(bind, endpoint)<br />
<br />
Dim info As New TestWCFService.CTPInfoData.myInfo<br />
info.Allowed = True<br />
info.Name = "Bert"<br />
<br />
' call our function<br />
Console.WriteLine("The answer is: " & IIf(ctrl.SetName(info), "YES!!", "No :("))<br />
Console.ReadKey()<br />
ctrl.Close()<br />
<br />
End Sub<br />
My proxy code was generated by svcutil /L:vb http://127.0.0.1:8027/CTPInfo
when I run this simple app, the service only gets a null object (nothing). But If I change the SetName() function to accept the string and boolean independantly, instead of inside a class, it works. So I know my WCF comms is working, just not the Data Contract stuff...
Does anyone have any tips in how to pass data contracts?
Or can point out where I have gone wrong?
Thanks,
Phil.
|
|
|
|
|
I'm reworking a WinForms application I wrote a couple of years ago.
It has a TabControl with a few TabPages. Originally I put the various Controls on the TabPages, but in reviewing it I decided writing a UserControl for each TabPage would be better (more modular, less monolithic).
But then I realized that if I derived each TabPage directly from TabPage (rather than deriving from UserControl and Adding the UserControls to the TabPages) I could save a layer of abstraction (I want one additional layer of abstraction, not two).
This works fine... except TabPage doesn't have the fancy schmancy Designer like those of Form and UserControl!
I looked a little at creating a Designer, but I don't want to go to that much trouble.
I am wondering whether or not it's possible to use the System.ComponentModel.DesignerAttribute to associate an existing Designer with my derived TabPage, perhaps one that Form or UserControl uses, but I haven't been able to track them down.
I see that others have asked similar questions on various forums, so I expect there's no easy way to do it.
Any other thoughts?
|
|
|
|
|
PIEBALDconsult wrote: I am wondering whether or not it's possible to use the System.ComponentModel.DesignerAttribute to associate an existing Designer with my derived TabPage, perhaps one that Form or UserControl uses, but I haven't been able to track them down.
It should be possible to do this. I've never tried it with a TabPage derived control, but I have done it with other controls and it works very well.
|
|
|
|
|
Could you point me in the right direction?
|
|
|
|
|
Sure. This would be the bare minimum implementation:
[Designer("System.Windows.Forms.Design.TabPageDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class CustomTabPage : TabPage
{
} The only issue is that you can't add these tab pages to the TabControl at design time since the TabControl class doesn't know anything about them. You can add the tab pages normally and then go into the designer code and change them by hand. (Even though the designer code is autogenerated, this change won't be lost the next time it is generated.)
If you want to be able to add them at design time, you would need to do some more work and create a custom TabControl derived class that knows how to add these controls instead of the normal TabControl .
|
|
|
|
|
Nah, that didn't work, but thanks.
Could you show an example of where you've had something like this work?
|
|
|
|
|
PIEBALDconsult wrote: Nah, that didn't work, but thanks.
What didn't work about that? I pulled that from a simple test app I created and it seemed to work there.
|
|
|
|
|
Didn't provide the Designer like that of a Form or UserControl. But I'm going to look at what you sent further, now that I've gotten some sleep.
|
|
|
|
|
Well, for one thing I needed to add a reference to System.Design
I think I actually need to use System.Windows.Forms.Design.ParentControlDesigner , and I've tried, but still no joy.
|
|
|
|
|
Or maybe it's System.Windows.Forms.Design.UserControlDocumentDesigner , still trying...
|
|
|
|
|
Hmmm...what is the behavior you are expecting and/or not seeing? When I added the System.Windows.Forms.Design.TabPageDesigner it gave me the same design time experience as the normal TabPage does.
|
|
|
|
|
Hi all, we are currently developing with the .net 2.0 version because we were asked to ensure compatibility with mono. Since Mono is implementing some of the features of the 3.0 version we thought to give to 3.0 a look, but we aren't sure what to install. Do we need a new version of the sdk? We Have found the redistributable package download, but it seems that the sdk is a separate file of more than 1 GB. Does it really require all that memory, given that we already have the 2.0 installed, or is there somewhere an update file?
Thank you!
|
|
|
|
|
It's not memory, just HDD space.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Err... thank you, perhaps my english is worse than I thought, I do know of course that it refers to the size of the file, not the memory required.
What I meant, is that we don't really need 3.0, we just want to give it a look, and we would be very unpleased to saturate the (currently limited) band of our temporary internet connection for 5+ hours just to discover that it is the wrong file.
So my question is:
Assuming that we have already the 2.0 sdk and runtime installed and running, which files do we need in order to be able to compile and execute a 3.0 program? And to be even more precise, we are working with c#.
Thank you again
|
|
|
|