แสดงบทความที่มีป้ายกำกับ asp.net mvc แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ asp.net mvc แสดงบทความทั้งหมด

วันพุธที่ 5 มิถุนายน พ.ศ. 2556

Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean)'.



[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
   Mot_Inspector_Report.Filters.SimpleMembershipInitializer..ctor() +260
 
This error can happen when u try to publish .NET MVC (asp.net 4.00)
because u use Entity Framework 5 with .NET 4.0 instead of 4.5   

simple to fix this is uninstall Entity Framework 5 and re Install it.

use library package manager to do this

and after that may be u found this because u update plugin with "library package manager"

The "EnsureBindingRedirects" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies)
   at Roxel.BuildTasks.EnsureBindingRedirects.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()    Mot_Inspector_Report
 

วันจันทร์ที่ 19 มีนาคม พ.ศ. 2555

MVC Jquery Json return internal 500

When use getJSON and call Action result correct but response internal 500

This is because json not allow get type (Only post can do.)
fix this is simple by

return this.Json( list, JsonRequestBehavior.AllowGet );

The key is AllowGet for can call function simple.

วันพฤหัสบดีที่ 15 มีนาคม พ.ศ. 2555

MVC3 and Uploadify Problem IO/HTTP Error

It work well if you not check authorize on controller
but it will not work if used authorize because uploadify use flash to upload.

for work around check on this post

http://stackoverflow.com/questions/8948000/mvc-3-uploadify-http-302-error
http://stackoverflow.com/questions/8358223/getting-http-error-while-using-uploadify-on-asp-net-mvc-application
http://stackoverflow.com/questions/3791724/getting-uploadify-to-work-with-asp-net-mvc
http://www.leftandmain.com/silverstripe-tips/2011/02/15/uploadify-http-error-explained-and-solved-maybe/
http://zootfroot.blogspot.com/2010/12/mvc-file-upload-using-uploadify-with.html

not sure if what the best solution but first and the second is the same.
I not write content here because i want to get rid flash from my project  for now this is temporary for use flash in my project.

Hope this help.

วันอังคารที่ 18 ตุลาคม พ.ศ. 2554

Problem with razor on MVC 3 ?

try this Quick Reference
http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx
and
http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax

วันพุธที่ 9 มิถุนายน พ.ศ. 2553

Link between Area and not Area.

because if you are in some area you must change area before use other control in other area.

Html.ActionLink( "Home", "Index", "Home", new { area = "" }, null )

Html.ActionLink( "About", "About", "Home", new { area = "" }, null )

Html.ActionLink("Install", "Index", "Install", new { area = "Install" }, null)

วันอังคารที่ 30 มีนาคม พ.ศ. 2553

Asp.net MVC make mistake about route name

Today I try to use route name in my MVC

string url = urlHelper.RouteUrl(routeName, routeValues);

Yes it don't work because it didn't find my route name

A route named 'Index' could not be found in the route collection.

Only route name "Default" i can use so what the point?

to use route name work you must map like

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Vsaving", action = "Index", id = "" } // Parameter defaults

in Global.aspx ( I still don't test this )

another way use Action instead Route like this

RedirectToAction(string actionName, string controllerName);

compare with

RedirectToRoute(string routeName); If want to go "Index2" or something you must routes.MapRoute before

This is clear?