|
We have a server we need to send text to and receive a response from (much like that for sending creditcard details and receiving a response).
No Protocol has been specified yet, but we know that it will be using SSL.
We have written a test harness that uses sockets to connect via TCP/IP.
I have been given the task of writing some more dummy apps to simulate how they might ask us to talk to their machine.
Has anyone found any articles that are relevant to my situation?
If I send using HTTP can I use HTTPWebRequest and HTTPWebResponse, or would creating an HTTPHandler be a better idea? Do I need to use the ServicePointManager with SSL?
Any help would be a life saver.
Regards,
Rik
|
|
|
|
|
If you use the HttpWebRequest and HttpWebResponse classes, the SSL handshaking is done for you so everything is transparent. A ServicePoint is just a way to manage connections, probably not something you need in a simple request/response scenario.
Here's another idea you should consider, though: XML Web Services. Not only does it take care of SSL automatically for you (the client proxy actually uses the HttpWebRequest and HttpWebResponse classes internally) but it also takes care of the protocol by which your client and server communicate. All you need to do is extend WebService (the easiest way is to either add a new web service class to your existing ASP.NET web application, or create a new ASP.NET web application that, if nothing else, simply hosts the Web Service) and add methods to it. Any methods to be exposed to clients should be public and should be attributed with the WebMethodAttribute .
XML Web Services are an industry standard and there are libraries for every major language available.
If you want to tie security, routing, encryption, etc. into this, take a look at the Microsoft Web Service Enhancements (WSE) 2.0 at http://msdn.microsoft.com/webservices/building/wse/[^]. This also uses industry standards like WS-Addressing, WS-Encryption, and many more defined by a consortium of industry leaders (including Microsoft, IBM, and others) and standardized by the W3C[^]. It can cetain aliviate a lot of problems with having to define a protocol and can handle a lot of complex data without you have to do a lot of work.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanx for all the help. You've given me lots of ideas.
I'm now reading up on them.
Thanx again.
Regards,
Rik
|
|
|
|
|
hai there,
when ever i compile my application, i am getting an error in task list.
" Satellite build for culture 'fr' failed. Please see the output window for more detailed error information."
Why this ? any idea ?
Please feel free to contact.
Sreejith S S Nair - Bangalore
|
|
|
|
|
Two possible reasons:
- The ressource assembly could not be written, because a file with the same name is alread there and locked (in use or "read only").
- Some of the ressources cannot be found or accessed (files missing or files in use).
|
|
|
|
|
If it isn't what Corinna said, then please post what the detailed error information is. Without the error, it's difficult to say what the error really is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I have a datagrid populated with values.When i move over particular row over the grid the row of the grid should get highlighted and the it should also get enlarged. Any Help on this will be much appriciated.
Thanx & Regards,
Rajeev
|
|
|
|
|
There's really no good way to do this. You need to implement custom DataGridColumnStyle s to aid in this (since the existing ones either don't support background and foreground colors, or in the case of the DataGridTextBoxColumn , only show the TextBox (which would support the different colors) when the field is being edited).
So, you'd have to implement one (perhaps deriving from the existing DataGridBoolColumn and DataGridTextBoxColumn to save you from having to re-implement the features) with the properties necessary to change the appearance, which you'd have to override the Paint property and draw them yourself (so understanding how DataGridColumnStyle s work is necessary - read the .NET Framework SDK).
Then, you have to handle the DataGrid.MouseMove event. In the handler, use the DataGrid.HitTest method to get the cell at the X and Y coordinates given in the MouseEventArgs . Get the DataGridColumnStyle for that cell and set those properties. This also means that when you move off the cell to another (or just off the DataGrid in general), that you have to reset the previous cell, which isn't an easy task.
With the amount of work involved, you might consider a third-party control that should already support this, like the XtraGrid from Developer Express[^]. Many third-party controls are very expensive and most are royalty-free.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
I wanna serialize an object into an XML document. However the XmlSerializer Class doesn't handle the private data for me.
so I write the follow codes for serialization
XmlTextWriter writer = new XmlTextWriter(new StreamWriter("TestFile.txt"));
writer.Formatting = Formatting.Indented;
WriteQuote(writer, symbol, price, change, volume);
writer.Close();
static void WriteQuote(XmlWriter writer, string symbol,
double price, double change, long volume)
{
writer.WriteStartElement("Stock");
writer.WriteAttributeString("Symbol", symbol);
writer.WriteElementString("Price", XmlConvert.ToString(price));
writer.WriteElementString("Change", XmlConvert.ToString(change));
writer.WriteElementString("Volume", XmlConvert.ToString(volume));
writer.WriteEndElement();
}
and the following codes for deserialization
XmlTextReader reader = new XmlTextReader("TestFile.txt");
ReadQuote(reader);
reader.Close();
static void ReadQuote(XmlReader reader)
{
double price = 0, change = 0;
int volume = 0;
string attribute = "";
reader.MoveToContent();
while(reader.Read())
{
if(reader.Name == "Price")
price = Double.Parse(reader.ReadElementString());
if(reader.Name == "Change")
change = Double.Parse(reader.ReadElementString());
if(reader.Name == "Volume")
volume = Int32.Parse(reader.ReadElementString());
}
Is there any simpler way to do it?
Thanks 
|
|
|
|
|
If you read about XML Serialization in the .NET Framework SDK (i.e., on the XmlSerializer class), you'll see that only public properties and fields are serialized.
If you want to override this behavior, you can implement an undocumented, not-supported interface (meaning they could change it at any time) named IXmlSerializable . It's declared as follows:
public interface IXmlSerializable
{
XmlSchema GetSchema();
void ReadXml(XmlReader reader);
void WriteXml(XmlWriter writer);
} The actual type is System.Xml.Serialization.IXmlSerializable . Implement that and read and write what you need. Keep in mind that the XmlSerializer uses either the IXmlSerializable implementation, or uses the XML Serialization attributes, but not both (meaning if you use the attributes, you'll have to take them into account yourself using reflection).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to add a logo to the top right of the menu bar (as in IE). How can I achieve this>...pls help
samitha
|
|
|
|
|
ImageIndex is an int type
[C#]
public int ImageIndex {get; set;}
but in design time , at property grid it showed that was a Image with combobox, why?
if I want add the imageindex property like this in my new control,how to define it?
|
|
|
|
|
lu ming wrote:
if I want add the imageindex property like this in my new control,how to define it?
add the Browsable(true) attribute to the property
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
That just tells the designer that the attribute is browsable, not how to edit the value. That's what a UITypeEditor is for, along with the EditorAttribute .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You should look into the System.ComponentModel namespace, specifically the EditorAttribute and UITypeEditor classes.
There are some already created for you, but you need to follow certain guidelines. For starters, the class in which you would define an ImageIndex property must have a Parent property that references a Control with an ImageList property type (the property name doesn't matter). Then attribute your ImageIndex property like so:
[Editor("System.Windows.Forms.Design.ImageIndexEditor, System.Design", typeof(UITypeEditor)]
public int ImageIndex
{
get { return imageIndex; }
set { imageIndex = value; }
} Here, imageIndex is a private field declared in your class to hold the value. Depending on how your component works, you may need to update the parent control.
If you don't follow these guidelines, you'll need to create your own UITypeEditor derivative.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath Stewart
under your answer,I found an article from here
http://www.codeproject.com/cs/media/extimageindexconv.asp
the red line must been added;
[Category("Appearance"), <br />
Description("..."), DefaultValue(-1)]<br />
[<font color="#FF0000">TypeConverter(typeof(ImageIndexConverter)), </font><br />
Editor("System.Windows.Forms.Design.ImageIndexEditor", typeof(UITypeEditor))]<br />
public int ImageIndex<br />
{<br />
get <br />
{<br />
return _ImageIndex;<br />
}<br />
set<br />
{<br />
if (_ImageIndex = value)<br />
{<br />
_ImageIndex=value;<br />
}<br />
}<br />
}
I think if I changed the ImageIndexConverter to a Converter class which I designed , In desingn time , will it show my Converter in property grid?
|
|
|
|
|
That's the idea, yes. Just make sure you reference the Type (either using typeof or a string representation, which is handy when you want to have a separate design-time assembly like Microsoft does for most members) in the ConverterAttribute .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
I would like to ask a question as below,
My software is composed of a main C# program with some other c# dll as components. In the first round, I will install all the stuff on the machine.
Then after sometime, I need to install some additional dll to work with
the main C# program. How can I do that ? Is that possible in C#.Net framework ?
The scenario is similiar to install Microsoft Office Suite, at the first time, I only install MS WORD with the MS Office main framework, but later I install also MS Excel (just like i install another DLL in my application)
onto the MS Office Main program on the PC.
Thanks
|
|
|
|
|
Yes it is possible but the initial design of your application will need to be carefully thought out. I'm actually working on a project that is very similar in nature to yours and we are using this method to develop more functionality to users over time and to patch specific parts of the system without actually going off-line.
The application we are writting is a trading application for different asset groups. We have a framework which compiles into an executable and all that framework does is authenticate the user again a database and see what permission the user has. GUI-wise the framework is just an MDI Parent window with a form that takes care of the login/authentication. When the user clicks on a menu only items that the user has permission to use appear as menu items. This is done with the combination of checking what DLL's are available on the remote server where all the DLL's reside on what the user has permission to access. So if a trader is an Equities trader he/she does not have access to Foreign Exchange screens/data so those images will not even appear inside the menu(s) of the framework.
All images that can run inside the framework are separate projects within the solution and produce DLL's into a common output directory (be careful because VS .NET is not too happy when you do this). When a bug is fixed and it's time to put the changes into the production system all we have to do is just move the newly updated DLL into a directory where the framework is expecting it and tell all the traders who need to use this updated image to close their existing image and open a new instance of it. I belive this is a very good way to design an application that will be used by many people since maintanance is very easy but on the down side it will take some time to "get it right" at first.
|
|
|
|
|
Yes,
" This is done with the combination of checking what DLL's are available on the remote server "
But I would like to know how to check what dll's are available on the remote server?
|
|
|
|
|
I'm following some of the tutorials at MSDN to embed Windows Media Player into my program. It's a simple problem. However, I can't seseem to get the controls to work. Even though I'm following the examples directly in the MSDN.
I declare the player and make it invisible and deactivate autostart:
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
axWindowsMediaPlayer1.Visible=false;
axWindowsMediaPlayer1.settings.autoStart = false;
So that runs find. Then I open a dialog box, read a file and store it in the player:
axWindowsMediaPlayer1.URL = openFileDialog1.FileName;
So far so good. But when I try to run the controls it states that .controls is not part of the AxWMPLib.AxWindowsMediaPlayer. However, according to the documentation it clearly states at Microsoft that to stop I could...
axWindowsMediaPlayer1.controls.stop();
But the above code will not compile. I get the sneaking suspicion that somehow I'm messing up obkjects. Between all the player objects and media objects and everything else do I have the wrong object type?
I'm using WMP9 SDK. If anyone has a clue, or can give me a simple answer, I would be gretaly obliged.
|
|
|
|
|
I had the same problem, i looked and looked and found that it was changed to Player.Ctlcontrols
so try axWindowsMediaPlayer1.Ctlcontrols to find play, stop, ect..
modified 16-May-21 21:01pm.
|
|
|
|
|
I'll give that a try. Thanks...
Is it just me or does the MSDN archive suck?
|
|
|
|
|
There is another problem using Playlist.item[ index ] you will get an error, its also been cahnged to Playlist.get_Item[ index ]. All these problems have been documented in the WMP 10 SDK now which im playing with now.
modified 16-May-21 21:01pm.
|
|
|
|
|
Okay cool... Now, I have the wmp sdk 9. Haven't updated to ten yet. Should I just assume the commands in 10 are mostly right for 9. Because even the 9 commands don't seem to work. for example, in 9 it states I can use:
player.cdromCollection.item(index).eject()
but that doesn't work. I have problems with item. So instead I tried:
player.cdromCollection.getByDriveSpecifier(drive).eject(); That works fine.
|
|
|
|
|