Read, With the Name of Your Lord Who Created

Archive for November, 2008

Error “‘Sys’ is undefined” in Asp.Net Ajax

Posted by triaslama on November 29, 2008

When I try ASP.NET Ajax in my development server I get this Javascript error: “‘Sys’ is undefined“. This error occur because I place <asp:ScriptManager runat=”server” /> element in my page.

Wondering why, I search in internet and hope that I will find one of the solution. After several trial and error finally I can find the solution and it work just fine for me.

To solve the error we need to modify web.config file, add the following under <system.web />

<httpHandlers>
<add  verb=”GET,HEAD” path=”ScriptResource.axd” type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
</httpHandlers>

Nothing more I can say, but if you get the same error when you work with ASP.NET Ajax try the above solution, and I hope this help.

Advertisements

Posted in ASP.NET, Javascript | Tagged: , , , , , , , | 14 Comments »

How To: Include File in ASP.NET Pages

Posted by triaslama on November 19, 2008

Sometimes programming its just the matter of style, I am not generalize but often I found that we can achieve one goal through many different ways. Lets inspect one of those! By right now I have try three different way on how we put a file in ASP.NET pages. I don’t know which one is the best, but all of the three has the same meaning: we can refer to a file and bring it where ever we like in our ASP.NET pages.

Yes, this is maybe the prefered way because if we include a file and we place it in all of pages -let’s say copyrights footer for example- Later if we want to change the copyrights with the new one, or modify it to something we want, we simply modify it in one place (in our referenced file) rather than go through all of our pages and change it one by one.

How we do this? I have tried three solutions to do that.

1. Using <!– #include file=”[filename].aspx” –>
The first (and maybe the old one) we just write a simple script (as show above) and specify the file we want to include. Place the above script where ever we want content of [filename].aspx appear in pages that referenced it. For security reason always try to include only *.aspx files.
Read the rest of this entry »

Posted in ASP.NET, Programming | Tagged: , , , , , , | 9 Comments »

App.config And Web.config, The Two Configuration Files Story

Posted by triaslama on November 12, 2008

In .NET programming world we govern setting for our program through configuration file (file with .config extension). We use web.config for web application (ASP.NET) and app.config for the rest.

Although both of config files share much similarities but both has difference too. Yes, I realize that many of you maybe already know what is the difference, but I wrote this because just a moment ago I realize one of the difference.

In ASP.NET we can just drop our web.config file in root of our virtual directory and this file will be referenced automatically, as simple as that. When we use app.config file -for example in Windows Forms application- the app.config file need to renamed with the same name as our executable file (or *.dll file for library). In visual studio this thing happen automatically, so when I try it manually (without any of IDE) the problem arise.

I write a very simple Winforms application (lets say I give this Winforms app. as test.cs), I write app.config file too then I place this app.config in the same directory with my simple Winforms program. Inside my Winforms program(test.cs) I retrieve a value from app.config file. Then I compile my source code manually (with csc command, so it will produce test.exe) and I run it. Unfortunately I get NullReferenceException! “Oh no, what was already happen. I think I’m not do something strange” maybe something like that I muttered.

Yes, I am not do something wrong except because I retrieve value from app.config! Suddenly I realize that my app.config cannot referenced by my executable file (test.exe) automatically (like what will happen in web.config case). Because I feel it’s strange (It work when I use Visual Studio but doesn’t work when I manually compile it) I inspect my Visual Studio files and I open bin directory. Finally I found this: the config file (app.config) renamed automatically by Visual Studio with the same name with my *.exe file, but with *.config extension.

Oh, so this is the matter. the *.exe file (or *.dll file) referenced config file automatically as long as the config file has the same name. So I rename my app.config become test.config, run again my test.exe and yes now it works.

Posted in Programming | Tagged: , , , , , | 1 Comment »

Ada Saja Alasan Untuk Malas Update Blog

Posted by triaslama on November 2, 2008

Perlu saya tekankan bahwa ini bukan pembelaan diri dari saya karena sudah beberapa saat (beberapa minggu) blog ini tidak ter-update. Ada saat dimana kita menjadi sangat enggan untuk meng-update blog, merasa bahwa update blog itu terkadang hanya buang – buang waktu, merasa bahwa banyak hal yang lebih penting dari sekedar update blog. Belakangan ini saya sedang mengalami hal tersebut.

Sehingga jadilah blog ini tanpa perubahan isi sama sekali selama berminggu – minggu, saya sendiri berharap masa itu akan segera (bahkan kalau bisa sudah) berakhir.

Ditulis di Jakarta pada suatu pagi ***  Tri Sugiyantowo.

Posted in Six Sense | Tagged: , | 2 Comments »