Archive

Posts Tagged ‘asp.net mvc’

ASP.NET MVC 1.0 + IIS6 = Error 404

October 23rd, 2009 ayah No comments

Have you found this problem when you tried to deploy your asp.net MVC 1.0 within IIS 6.0 server ? I do…

After search for awhile I found out there are several solutions for this problem. Four of them, you can find it here . But I found out, that it’s not the easiest thing to do. The easiest solutions is here

Option 1: Use a wildcard mapping for aspnet_isapi.dll This tells IIS 6 to process all requests using ASP.NET, so routing is always invoked, and there’s no problem. It’s dead easy to set up: open IIS manager, right-click your app, go to Properties, then Home Directory tab, then click Configuration. Under Wildcard application maps, click Insert (not Add, which is confusingly just above), then enter C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll for “Executable”, and uncheck Verify that file exists

Categories: Programming Tags: ,

MVC, Ajax and Internet Explorer

March 23rd, 2009 ayah No comments

Internet Explorer mempunyai kelemahan apabila ada request yang bersifat async (ajax). Dia tidak akan langsung melakukan load terhadap request yang dimaksud, tetapi dia akan melakukan load dari cache apabila cache yang berkaitan dengan request tersebut masih valid. Sehingga response yang diberikan adalah data dari cache.Nyebelin ya…ini yang bikin rese….
Pada webform standar sebenarnya cara untuk mengatasinya mudah yaitu memasukan code berikut pada setiap postback, enaknya sih dimasukan ke event Page_Load sehingga perlakuan ini akan tetap melekat pada setiap request

   Response.CacheControl = "no-cache";
   Response.AddHeader("Pragma", "no-cache");
   Response.Expires = -1;

Dengan begitu, tidak ada yang namanya loading dari cache. Untuk asp.net mvc, caranya agak berbeda, karena konsepnya aja dah beda. Anda harus meletakkan code diatas pada event OnActionExecuting (override dari class Controller). Sehingga code yang didapatkan adalah

  protected override void OnActionExecuting(ActionExecutingContext filterContext)
  {
    if (Request.IsAjaxRequest())
    {
         Response.CacheControl = "no-cache";
         Response.AddHeader("Pragma", "no-cache");
         Response.Expires = -1;
       }
       base.OnActionExecuting(filterContext);
    }
  }

Bedanya dari kedua code diatas adalah, Webform tidak dapat mengidentifikasi request yang dimaksud adalah cache atau bukan, sebaliknya, asp.net mvc dengan sebuah extension function dapat mengidentifikasi apakah request tersebut ajax atau bukan.

Categories: Programming Tags: ,

Finally released ASP.NET MVC

March 19th, 2009 ayah No comments

Akhirnya asp.net mvc keluar!!! cihuyyy…penantian lama setelah pertama kali keluar sebagai CTP pada tanggal 10 Desember 2007, dan kemarin tanggal 17 Maret 2009 released sebagai versi final 1.0. Silahkan unduh ke download link

Gambaran sekilas mengenai ASP.NET MVC (diambil dari Wikipedia)

The ASP.NET MVC Framework is a Model-view-controller framework which Microsoft is adding to ASP.NET.
It allows software developers to build a Web application as a composition of three roles: Model, View and Controller. A Model represents the state of a particular aspect of the application. Frequently, a model maps to a database table with the entries in the table representing the state of the table.
A Controller handles interactions and updates the model to reflect a change in state of the application. A View extracts necessary information from a model and renders a user interface to display that.[1]

The ASP.NET MVC Framework couples the models, views, and controllers using interface-based contracts, thereby allowing each component to be easily tested independently.
By default, the view engine in the MVC framework uses regular .aspx pages to design the layout of the user interface pages onto which the data is composed.
However, different View Engines can be used (for example, you can create a View Engine based on XSLT files).[2]
Additionally, rather than the default ASP.NET postback model, any interactions are routed to the controllers using the ASP.NET 3.5 SP1 Routing mechanism. Views can be mapped to REST-friendly URLs.[1]

Bagi yang belom pernah make ASP.NET MVC, silahkan cek ke Tutorial.
Ini beberapa link tentang perbedaan ASP.NET MVC vs WebForm

Categories: Programming Tags: , , ,