Create Thread null value

Apr 24, 2012 at 10:05 PM

Hello

I am getting the following error.

[ArgumentException: The parameters dictionary contains a null entry for parameter 'page' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult List(System.String, Int32)' in 'NearForums.Web.Controllers.UsersController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters]

I am integrating nearforums into an existing solution from the source code. It is set up like this:

----

Multiple NearForums projects (NearForums, DataAccess, ServiceClient, Tests, Web, Web.Controllers)

App

-Areas

-Forums

-NearForums.Web.Output folders

-App default directory

----

I have been successful this far, but I am in Front End and I am having trouble figuring this one out. I can provide more info if needed.

Thank you for this great contribution and thanks in advance.

Coordinator
Apr 25, 2012 at 7:51 AM

Hi Johnny,

From what I can see, the routes are not correctly configured. For this route, page should have a default value of 0.

I'm glad your enjoying the project!

Kind Regards,

Jorge

Apr 25, 2012 at 1:49 PM

Hello Jorge

Thank you.

Where/how do I configure the routes? In the Routes.config file? Or, do I need to specify the routes with parameters in ForumsAreaRegistration.cs or Global.asax (in this case)? I added page = 0 to the link in List.cshtml (for example) to test this and it works. I am new to mvc and I am taking the deep dive into routes and don't fully understand where to configure them in this case.

 Thank you,

Johnny

Coordinator
Apr 25, 2012 at 2:07 PM

Hi Johnny,

Normally the routes of an area should be registered inside the area registration, but where you must register the routes of the area is up to you. 

On Nearforums we do it on the global.asax because we don't use areas, invoking the method RoutingHelper.RegisterRoutes(RouteTable.Routes, RouteMappingConfiguration.Current).

 

You will find integrating Nearforums (or any other solution) into an area of another asp.net mvc project very hard... If you are doing it to test and to try diferent ways, its OK, but if you are doing it just to have a forum on your website I recommend you that you setup nearforums as a subsite, like http://yoursite.com/forum/. This way it will work without need of coding anything.

Kind Regards,

Jorge

PS: if you have the possibility of use subdomains on your hosting environment, you can install it on a different website with host forum.yoursite.com

Apr 25, 2012 at 4:45 PM

Hi Jorge

Thanks again. Very useful information.

When doing research on setting up the project, I had a couple of concerns when considering Nearforums as a subsite: 

-Sharing templates/partials in main site and forums subsite

-Sharing css/images/downloads, basically any links/assets/resources across main site and forum subsite

-Adapting Nearforums into the Responsive Design of the current site - maintaining consistent look and feel

-Cross site authorization

-Routing across main site and forum subsite

-Using MvcSiteMapProvider to build dynamic navigation and menus

Just to list a few. Some of these items are less of a concern than others. I am trying to adhere to a DRY set up to make it easier for maintenance. So the real question is this; Do you think setting this up in a subsite is easier? It's a genuine question, no sarcasm intended. I value your experience and will make it a subsite if I'm not able to code my way out of the current set up.

Thank you very much!

Johnny

Coordinator
Apr 26, 2012 at 8:24 AM

Hi,

IIS subsite is the way to go, its easier to install and you won't have to code anything.

My answers below:

-Sharing templates/partials in main site and forums subsite

You can create a template "mocking" your main site layout.

-Sharing css/images/downloads, basically any links/assets/resources across main site and forum subsite

No problem, if you are in a subsite inside iis, you can use a path related to the domain like /styles/main-site.css

-Adapting Nearforums into the Responsive Design of the current site - maintaining consistent look and feel

No problem.

-Cross site authorization

Check out this tutorial: How to authenticate users from an existing db into Nearforums site

-Routing across main site and forum subsite

Main site and forum sub application would be 2 different applications in the same IIS website. It won't affect each other. You should create your main site without taking care of the subsite.

-Using MvcSiteMapProvider to build dynamic navigation and menus

I'm not really aware about how it works...

 

Kind Regards,

Jorge

May 1, 2012 at 4:51 PM

Hi Jorge

Thanks for your help! I have set it up as a subsite. I haven't set up a subsite in iis before. How should I set it up in iis?  

Option 1

-----

-Sites

-MainSite

-MainSiteApp

-ForumsApp (Forums App in subdirectory)

------

or Option 2

------

-Sites

-MainSite

-MainSiteApp

-ForumsApp (MainSiteApp and ForumsApp on same directory level)

------

Thanks Johnny