Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Doubt using beginForm
luiz@wise.com.br
#1 Posted : Thursday, July 15, 2010 9:24:25 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
I don't know if this is the correct result

if I use this line

Code:
<% using (Html.BeginForm("create","quiz")) {%>

I get this result and this is correct
Code:
<form action="/home/index/quiz/create" method="post">


But If I use this line

Code:
<% using (Html.BeginForm()) {%>


I get this result
Code:
<form action="/quiz/Create" method="post">


and this is the error


Code:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 104: {
Line 105: var svc = Context.ContentService;
Line 106: return svc.GetContentsByFolder(FolderName, queryStatement, orderBy, queryValues, startIndex, pageSize, this.CacheTime)
Line 107: .Select(content => WriteModel(CreateTModel(content, null)
Line 108: , content)).AsQueryable<TModel>();


Source File: C:\Projetos\Produtos\Framework Campanha\Kooboo\Kooboo.Module.Core\Repository\RepositoryMethods.cs Line: 106

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Everest.CmsServices.MvcHelper.ContentService.GetFolder(String folderName) +82
Everest.CmsServices.MvcHelper.ContentService.GetContentsByFolder(String folderName, String queryStatement, String orderBy, NameValueCollection queryValues, Int32 startIndex, Int32 pageSize, Nullable`1 cacheTime) +71
Kooboo.Module.Core.Repository.RepositoryMethods`1.Query(String queryStatement, String orderBy, NameValueCollection queryValues, Int32 startIndex, Int32 pageSize) in C:\Projetos\Produtos\Framework Campanha\Kooboo\Kooboo.Module.Core\Repository\RepositoryMethods.cs:106
Kooboo.Module.Core.Repository.RepositoryMethods`1.Query() in C:\Projetos\Produtos\Framework Campanha\Kooboo\Kooboo.Module.Core\Repository\RepositoryMethods.cs:125
Kooboo.Module.Quiz.Controllers.QuizController.Index() in C:\Projetos\Produtos\Framework Campanha\Kooboo\Kooboo.Module.Quiz\Controllers\QuizController.cs:28
lambda_method(ExecutionScope , ControllerBase , Object[] ) +74
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +52
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +254
System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +314
System.Web.Mvc.Controller.ExecuteCore() +105
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +59
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8679150
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927



Looks like the problem is in the ModuleHttpReqeust class (and the class name should be ModuleHttpRequest)
The first methos uses the RawUrl to render the form action, and the HttpContex.Current.Request.RawUrl is /home/index/quiz/Create but the Html.ViewContext.HttpContext.Request.RawUrl is /quiz/Create

is this correct?


Baseless
#2 Posted : Thursday, July 15, 2010 11:05:33 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 135
Location: Sweden
I noticed this problem as well, that empty beginforms dont work.
luiz@wise.com.br
#3 Posted : Tuesday, July 27, 2010 2:25:22 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 3/4/2010(UTC)
Posts: 157
Location: brazil
Any information about this?
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.054 seconds.