Wednesday, October 10, 2007

Blog's view changed!!! :(

Hi there,
Unfortunately I have to change the face of the blog. The reason for this action that the current view does not fit well when a code snippet is post - like in my last post. I do not like tthe current design very much but this is the only one template that fits my needs. I'll try soon to edit the template and make it with a little bit better design.

Tuesday, October 9, 2007

Using exsiting IE cookies with HttpRequest

I've come accross an idea of making my own web spider with .Net. My tests were to grab information from the Experts-exchange site. I've used a code like this

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

The request passes correct and getting the response was working well also. However the content of the response was not the correct one - I mean that it was different than the one I can see if I open an explorer.

What was the difference? The difference was the cookies! When I open the Internet Explorer and navigate to EE the EE server accepts me as logged in user using my cookies. However using the programatically created web request no cookies are associated with the request and the server does not show me the information I want.

During some research and some test I've come across the InternetGetCookie function. This function allows you to get the cookies stored by the Internet Explorer and assign them to your web request.

Here is the code I've come to:

public class RequesstWithCookie

[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]

static extern bool InternetGetCookie(string lpszUrlName, string lpszCookieName,
[Out] StringBuilder lpszCookieData, [MarshalAs(UnmanagedType.U4)] out int lpdwSize);

CookieContainer cookies;

public RequesstWithCookie(String siteUrl)




public HttpWebRequest CreateRequest(string pageUrl)


Uri uri = new Uri(pageUrl);

HttpWebRequest request = null;
request = (HttpWebRequest)WebRequest.Create(uri);
request.CookieContainer = cookies;

return request;


private void LoadCookies(String url)

cookies = new CookieContainer();
Uri uri = new Uri(url);

StringBuilder cookieBuilder = new StringBuilder(new string(' ', 256), 256);

int cookieSize = cookieBuilder.Length;

if (!InternetGetCookie(url, null, cookieBuilder, out datasize))


if (datasize <> 0)




cookieBuilder = new StringBuilder(datasize);

InternetGetCookie(url, null, cookieBuilder, out datasize);


cookies.SetCookies(uri, cookieBuilder.ToString().Replace(";", ","));



Hope this code will help somebody else to not lose an hour or more to find this out.

Wednesday, October 3, 2007

Second edition of DevReach finished

This was just a wonderful event. I've been for second time on the DevReach in Sofia, Bulgaria and it was just amazing. For second time I have the ability to participate in sessions of Richard Campbell, Stephen Forte and Carl Franklin. I also participate in a session of Miguel Castro that is another amazing speaker.

Hope that this event will developed itself in future and will bring to Bulgaria more and more speakers of this rank.

There was a little problem with the rooms - some of the rooms was to small to hold everyone that wish to listen Stephen Forte or Miguel Castro. Hope that next year this part of the event will be better.

Thursday, September 13, 2007

DevReach event,Sofia, Bulgaria; 1-2 October, 2007

There will be a realy good event this year about developers in Sofia. This will be the second edition of the DevReach. I think that the first edition was one of the best developers events in Bulgaria and as I can see in the speakers' list and the sessions titles - this year we should expect much more ( Richard Campbell, Dino Esposito, Stephen Forte, Carl Franklin and more).

There is a discount if you register before 18th of September, so hury.

Wednesday, September 12, 2007

Experts exchange solutions

This is a list with solutions provided by the experts in the Experts exchange for the last week.Remember that if you want to see the solution you must register in the site first.

text box label backcolor change on the fly
CLR Integration: Visual Studio 2003, SQL Server 2005
How can I make the child Form's ToolStrip merge with it's parents? (.NET C++/CLI)
How can I tell if the .Net Framework has been installed on a network
Using, how to send POST request with post data and save the binary response to a file?
Difference between standard and pro version of visual studio
Dynamic Parameter List
License a dll
Unable to Run Exe from Another PC
WebDav & Exchange: Create appointment, avoid overwrite existing one

License a dll
How do I capture the information of the Toolstripmenuitem that was clicked
Unable to Run Exe from Another PC
Menustrip window forms - how do I find the hierarchy of menu items that lead to the menu item clicked and close the dropdownitems
aggregattion in datagridview 2.0
WebDav & Exchange: Create appointment, avoid overwrite existing one
Error loading image

Using, how to send POST request with post data and save the binary response to a file?
How can I get a list of groups in Active Directory and find out who is in those groups
How to communicate with a device (printer or something else) using an ethernet card
Obtaining Host IP Address
Row Already belongs to this table
Function () with multiple Return values
'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and 'Outlook.ItemEvents_10_Event'.
Error Handling in MS Word, Merged rows count issue
Dynamic Parameter List

text box label backcolor change on the fly
How can I tell if the .Net Framework has been installed on a network
Understanding "Public Shared" Declaration

Tuesday, September 4, 2007

A trip to an ancient world

Last week my dream came true - I've been on a trip to Rome.
Just one week that allows me to see some of the greates things of the world - monumentals, churches and wonderful night life.

It was a pleasure to see another world that was the most powerfull empire in the past. Everything in Rome is fulfilled with energy, glory of the past and smile of the present.

This is a town where you can spent a life and a half to see, understand and become a part of it - not more or less. A life and a half. You can see a monumental or a church right after each corner, you can feel the power of the Catholic Church (even you are not a Catholic).

However I felt the calmness only in those small churches that you can not see on the map. The cursches on those small streets that are not named on the map.

When you see the gloriest Basilica St. Pietro, the Vatican's Museums you will understand why you must another life and half devoted to Rome.

And of course the trip will be incomplete if you don't feel the night life of rome with all the smiled faces of the Italian people, artists and musicians.

If you can afford it - you must definitely go to Rome.

Monday, August 20, 2007

Some good links August 20

Boxing/Unboxing In .NET
System Setup for .NET 3.0 and .NET 3.5
NGEN perf boost in red bits
The .NET Show on Silverlight
Callbacks, ConcurrencyMode and Windows Clients
Enterprise Library 3.1
C# static constructors are called on demand, not at startup
Analyzing .NET Patches
Materials on .NET FAQs List
10 Things You Should Know About Microsoft's Silverlight
Extension methods and .NET 2.0

Multiple Enumeration of LINQ results
LINQ to SQL in Beta 2
LINQ to SQL (fka DLinq): What's new in Orcas beta2
Inserting new records with the ListView & LinqDataSource
LINQ to SQL (Part 6 - Retrieving Data Using Stored Procedures)

Make your ASP.NET application extendable
ASP.NET Orcas Designer Customization
Master Page Reuse Across Applications
ASP.NET 2.0 FileUpload Server Control
How Do I: Determine Whether an Asynchronous Postback has Occurred?
Storing And Displaying Image From Database
Cool new ASP.NET 3.5 and Silverlight demo application
Strong password checker online
Developing IIS7 modules and handlers with the .NET framework
Make your web application run faster
GridView and Paging Alignment
Workflow + InfoPath Forms, Form is not workflow enabled??

DatePicker in ASP.NET 2.0 and AJAX Control Toolkit
Nevron .NET Vision Q2 2007 now available - AJAX Support, Gauges and many more
VS 2008 Tools menu

Prepare for growing projects
Reading to Be a Better Developer - The Coding4Fun DevKit
Generic Methods
Smart enumerations
Design Patterns
Fading Forms In and Out
Silverlight Controls
Automatically GAC an assembly after a build and include debug info.
The Daily Grind 1207
Design Patterns
When BizTalk meets SharePoint, it makes sense…
ESB Guidance
What is the order of evaluation in C#?
Why the debugger will not hit your breakpoints?
E -Books Collection( Free Torrent Download)
Microsoft Interview Questions
Running FxCop and the quirks
CopySourceAsHtml in Visual Studio 2008
SOA in the Real World
Microsoft Biztalk Server 2006 Management Pack for Operations Manager 2007
Using managed code to detect what .NET Framework versions and service packs are installed
Building LINQ Queries at Runtime in F#
A couple SharePoint logging tricks (Dev Environment only)
Mixing VS2008 with VS2005