|
i have seen the MSDN.
but it told me.
don't create HttpWebResponse directly,you should get it from HttpWebRequest.GetResponse.
but i don't have any HttpWebRequest.i only kown the HTTP string
GET /?forumid=1649&fr=51 HTTP/1.1<br />
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, *
i want use an analyser to get the HTTP heads and Params. i want input HTTP string and the analyser can give me anything i want,just like System.Web.HttpRequest.
|
|
|
|
|
Then just do simple line parsing? Use a StringReader and loop through the lines. Split the line on the first colon found:
StringDictionary lookup = new StringDictionary();
using (StringReader reader = new StringReader(httpString))
{
string methodAndRequest = reader.ReadLine();
if (methodAndRequest != null)
{
line = reader.ReadLine();
while (line != null)
{
if (line == "\r\n") break;
string[] header = line.Split(new char[] {':'}, 1);
if (header.Length == 2)
lookup.Add(header[0].Trim(), header[1].Trim());
}
}
}
Console.WriteLine(lookup["Host"]); It's a simple parsing algorithm. If you want, you could further break-down known headers to typed classes or whatever you want to do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
My simple question is, how do I controle wich user controle is drawn atop and wich is below, whenever these are placed in the same area?
I would like to tell one of the controles to stay on top, and the other to go belov, like a Z index.
Regards
Janus
|
|
|
|
|
The last two buttons (by default) on the Layout tool in Visual Studio.NET deal with control layering. Hope this helps.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
To do this programmatically call either BringToFront or SendToBack method which are inherited from the Control class.
www.troschuetz.de
|
|
|
|
|
Thank you very much
So simple
|
|
|
|
|
As a sitenote I can just tell you all that you have to call these methods, after you add your controls to your form/panel and so on.
Like this:
this.Controls.Add(line1);
line1.BringToFront();
And NOT:
line1.BringToFront();
this.Controls.Add(line1);
Dont know why, but I found out the hard way
Thank you again, for your quick answer ;o)
|
|
|
|
|
When you add your line1-control to the collection of controls, the z-order is updated with the line1-control added to the back, so that the previously called BringToFront method has no effect.
www.troschuetz.de
|
|
|
|
|
How can I set DataGrid row properties depending on its contents (i.e. if the value in column 3 is equal to "Mike" then set the full row background to yellow, if it is equal to "Bob" set the background to cyan, and so on) ?
Thank you for your help.
Maurizio Poggi
|
|
|
|
|
|
I want to get Email Address from WAB ,but I dont't konw how to do . If someone know it ,please help me. I am waiting on line.
|
|
|
|
|
It's not very simple at all. There are articles out there (did you try googling?), though not many using .NET languages like C#.
Look through the MSDN Online Library[^] for the IAddrBook interface. You'll have to re-declare these interfaces in managed code because the typelib importer won't be able to. You'll also have to P/Invoke all the related functions also listed in the documentation under Widnows Address Book[^] in the Web Development section.
Make sure you have a good working knowledge of unmanaged types vs. managed types, like that an unmanaged long is actually a managed int (Int32 ). It also helps to understand COM interop in .NET. Read the section Interoperating with Unmanaged Code[^] in the .NET Framework SDK for more information about both P/Invoke and COM interop.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am using word 10.0 object library for the printing of the creation of a word document ( with office 2002) it works fine on windows xp but when i deploy the same application on windows 2003 server it doesn't work.
The following Error is generated
" Message Filter Application is Busy";
Can anyone help in this regard
|
|
|
|
|
many anti-virus softwares have they own virus database for scaning.
also i want to build my own database for scaning.
But i dont know how to build one.
and how to search items quickly in the database?
|
|
|
|
|
hi,
You can build your own database using datset object. Create a table and clolumns as you require and then populate the dataset as and when required with the necessary data.
You can persist the dataset as an XML file and reinitialize it by reading from XML file.
In dataset it is possible to run a "select" query and retrieve the data like anyother databases.
If your database is simple name-value collection then you might think of using or extending HashTable class...
Hope this answers your query.
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
What Aryadip suggested is hardly quick, depending on the volume you expect to fill your data structure. A virus definitions database, for example, would be far too much for a local DataSet .
Designing your own database requires a good working knowledge of data structures. I suggest you get a good book from Amazon or a university near you about data structures, or take a class if possible. This is well beyond the scope of this or any forum, since some knowledge is required.
There are file-based alternatives out there that would be quicker. The Jet Database (aka - though incorrectly - as Access databases) provides a file-based relational database management system (RDBMS) where you can use ADO.NET. Using an MDB doesn't require that you have Access installed (though it's handy to design the empty database). Access is just an application that uses Jet databases.
There's several other file-based databases as well - just http://www.google.com[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hello
i need help in converting the serial date in Excel into a proper datetime format to be shown in the ListView(in C#)
basically i've imported all the field from an excel worksheet and tabulated into a listview component in C#.
besides i've just read an article about the conversion of Excel datetime into readable format, but i still dont understand the concept of the code.
could anyone out there can guide how to do it?
thank you
|
|
|
|
|
If you have a serial number, simply create a new DateTime starting from 1/1/1900 00:00:00 and add days like so:
DateTime base = DateTime.Parse("1.1.1900");
DateTime fromExcel = base.AddDays(serial); If you want to convert from an OLE Automation date/time (which excel uses), you can use DateTime.FromOADate . Read the .NET Framework SDK documentation for the DateTime structure and its members for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I used to do this in vc++
inline CMyApp* GetApp()
{
extern CMyApp theApp;
return &theApp;
}
How can I do the same with c# ? The reason is I want my other forms to have access to my main forms resource manager to get strings for localization.
Thanks
|
|
|
|
|
I use the singleton pattern to approach this. There you'll have an unique instance of your MainForm which can be accessed throughout your application.
class MainForm
{
public static MainForm Instance
{
get
{
if (MainForm.instance == null)
MainForm.instance = new MainForm();
return MainForm.instance;
}
}
private static MainForm instance;
protected MainForm()
{
}
}
www.troschuetz.de
|
|
|
|
|
ok thanks! I found it later when I recalled the word static.
|
|
|
|
|
Hi,
I was wondering if it's possible to display select columns from a DataTable to the DataGrid? The code below (of course) displays all the columns in my DataTable.
//view the DataTable in a DataGrid
dataGrid1.SetDataBinding(myDataTable,"");
Thanks!
Ron
|
|
|
|
|
Add a DataGridTableStyle to your grid. Any columns in your table that do not map to a DataGridColumnStyle in your DataGridTableStyle will not be shown. Or you can add a DataGridColumnStyle for every column and set the Width property to zero for the columns you don't want shown.
DataGridTableStyle style = new DataGridTableStyle();
style.MappingName = "myDataTable";
DataGridColumnStyle colStyle = new DataGridTextBoxColumn();
colStyle.MappingName = "col1";
style.GridColumnStyles.Add(colStyle);
colStyle = new DataGridTextBoxColumn();
colStyle.MappingName = "col2";
style.GridColumnStyles.Add(colStyle);
colStyle = new DataGridTextBoxColumn();
colStyle.MappingName = "col3";
colStyle.Width = 0;
style.GridColumnStyles.Add(colStyle);
dataGrid1.TableStyles.Add(style);
Charlie
if(!curlies){ return; }
|
|
|
|
|
Thanks Charlie... I'll give it a go.
Another related question to DataTables:
I'm trying to save a DataTable to an Access DB. My search has come up with this: "Only the DataAdapter serves as a bridge between a DataSet and a data source for retrieving and saving data..."
My question is: Can I use the DataAdapter with a DataTable (not DataSet) to save to the Access db?
Ron
|
|
|
|
|
No. Your DataTable would sit inside a DataSet and be the only table in the set.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|