JSON stands for Javascript Object Notation and this is the new lightweight (then XML) standart for transferring data from one point to another over the network. Here you can find a sample web page codebehind to see usage in C#. Static methods in ‘Functions‘ class Happy codings…
SiteMapPath Url Querystring problem
When you are using the SiteMapPath control page Urls with the querystrings, pages don't show the control. Because url can't be matched with url in your Web.Sitemap file. To handle this situation, a little web.sitemap file trick is enough. Write the static part of your Url and define the dynamic querystring parameters at "reliantOn" attribute. […]
Timespan and Databases
When you are developing application you may need to store timespan database. (Assuming you are using Sql Server 2005) TimeSpan.TotalSeconds can be used to store. This returns a double. And maps to decimal data type of the sql server. For reverse action to get the time span you can use TimeSpan.FromSeconds method. This will give […]
How to use overloaded methods with ASP.NET Web Services
In .NET world it’s very common to write methods with same name but different parameters. This is called overloading. And if you use this technique wisely you can prevent some code repetation. But in the web services world of .net its not allowed by default. If you try you get an exception says : “Bla, […]
Problem with classes under App_Code folder in VS 2008
We are developing a new ASP.NET web application in Visual studio 2008. Last week we’ve decided to use HttpHandlers instead of some web pages. And as we used to do in Visual Studio 2005 web sites created an App_code folder after that we created new classes under that folder. Then we noticed that there is […]
Access to Session State from Http Handler
Sometimes you need to use Http handlers to respond to requests rather than classical asp.net pages. At that times if you want to use session objects you will see that HttpContext.Current.Session is null. If you want to read session state from you http handler your http handler must implement System.Web.SessionState.IReadOnlySessionState interface. If you want to […]
Culture ‘tr’ is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread’s current culture.
You get this error, when you use neutral culture name to set culture of the application. 1 System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("tr"); 2 System.Threading.Thread.CurrentThread.CurrentCulture = ci; 3 System.Threading.Thread.CurrentThread.CurrentUICulture = ci; To prevent this error you can use explicit culture name like "tr-TR" or use the code below: 1 System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("tr"); Happy coding.
Register your user controls and custom controls in Web.Config
In ASP.NET web application you can develop user controls and custom server controls to increase your productivity and decrease code repetition. To use these user controls at your web pages you can register like this: <%@ Register Src="Controls/somecontrol.ascx" TagName="SomeControl" TagPrefix="myPrefix" %> And use like this: <html> <body> <form id="form1" runat="server"> <myPrefix:header ID="SomeControl1" runat="server" /> </form> </body> </html> The registration step can […]
ASP.NET MVC 1.0 RC (Release Candidate)
Milliyet gazetesi Internet yazılım hizmetlerinde çalışmaya başladığımda arabam.com web sitesinin mevcut veritabanı ve sınıf kütüphanesi kullanılarak yeniden yazılamsı isteniyordu… .NET 1.1 de geliştirilmiş olan mevcut uygulamayı yeni teknolojilerle yazalım istedik… Visual Studio 2008 + .Net Framework 3.5 + MVC Framework Preview ile geliştirme yapma kararı alındı… Özellikle preview durumda olan bir framework kullanmak oldukça çılgın […]