November 2008 - Posts

I was waiting for such day since 3 years. When i wake up i usually start my day by reading some of my favorite ASP.NET blogs. One of them as you might have realized is Scott Guthrie. Scott announced today the release of an ASP.NET chart control in which you can embed inside an ASPX webform. for more information check below blog post

New ASP.NET Charting Control 

Enjoy

Posted by haissam | with no comments

 As you may already know, one of the reasons why the asp.net worker process recycles which kills all the session variables in memory is due to dynamically deleting a folder under the root application folder. You have two options to follow in this case

1- To use out-of-process mode session
2- To use the below code which uses reflection to disable monitoring for the folders inside the application. In this way, once you delete a folder, the Application domain won't restart thus you won't be losing any session variable

PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic | BindingFlags.Public |  BindingFlags.Static);
object o = p.GetValue(null, null);
FieldInfo f = o.GetType().GetField("_dirMonSubdirs", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", BindingFlags.Instance | BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });

Do not forget to import System.Reflection Namespace

Hope this helps,

Posted by haissam | with no comments

Well it started out from 3 and a half years when i start working in my company and start building web applications using ASP.NET. I used to concentrate too much in the design and planning phase of the project then when it is time to write code, I grab my headphones and start my trance playlist (which is about 25 GB). Listening to music in the development phase in my case could be because of two factors

1- Disconnect myself from the surrounding. We used to be 4 developers in 1 medium sized room and of course you know about the chit-chatting between employees which might distract other employees.

2- Somehow this type of music makes my imagination works better. After several self monitoring sessions, I found out that i could write more effective code and be able to provide neat solutions while listening to trance music.

Up till today, i still get comments on how I’m able to perform in such environment but only the success of my projects will answer that question!

Happy coding...

 

Posted by haissam | with no comments

Bilal has worked hard to publish his first book titled "Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB.NET". Finally it is in stock now. Check out below link

Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB.NET

I wish for Bilal lots of success in the future and hope this book won't be the last.

Regards,

 

Posted by haissam | with no comments

 In this blog post, we will see how to create an XML schema file for an xml file and how to validate if a certain XML complies to our schema.

First of all, open the XML file in Visual Studio. Right click the solution explorer select add Existing file and select the xml file. Open the file and choose from the menu XML --> Create Schema.
Now you have the schema and the XML file, it is time to write some code to validate the xml file.


            try
            {
                    XmlReaderSettings settings = new XmlReaderSettings();
                    settings.Schemas.Add(null, XSDFILEPATH);
                    settings.ValidationType = ValidationType.Schema;
                    XmlDocument document = new XmlDocument();
                    document.Load(XMLFILEPATH);
                    XmlReader rdr = XmlReader.Create(new StringReader(document.InnerXml), settings);
                    while(rdr.Read()){}
            }
            catch
            {
                isValid = false;
            }

if the validation fails, a private field is set to false (isValid) in which you can check at runtime to see if the status of the validation process.

Hope this helps,

Posted by haissam | with no comments
The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.