Monday, October 15, 2007
Some good links October 15
Hierarchical Exception Handling with Enterprise Library
Progress indicators vs. Progress cursor
.Net and Deep Copy
Web Services Best Practices
HttpModule and HttpHandler sections in IIS 7 web.config files
ASP.NET
xacc.propertygrid
Cell Merging of DataGrid in ASP.NET
Management
The myth of the part time Scrum Master
Using Scrum on a multi project development team
Other
BizTalk Services: An overview
Bringing Agility to Architecture, and Architecture to Agility
Wednesday, October 10, 2007
Blog's view changed!!! :(
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
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)
{
LoadCookies(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)
{
return;
}
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.
Thursday, October 4, 2007
Some good links October 04
NUnit Templates and Snippets for Visual Studio 2005 - Now support C#
Releasing the Source Code for the .NET Framework Libraries
ASP.NET
10 Hot ASP.NET Tips and Tricks - 9/28/2007
The ASP.NET Page Lifecycle – A Basic Approach
ASP.Net : Clean up your use of ViewState
Other
Take control of your interview
Scrum for Team System Tips
10 cool web development related articles in 2007
Wednesday, October 3, 2007
Second edition of DevReach finished
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.