MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Extending Modules in ASP.NET Framework 4  (Mono Support )

Viewed 35063 time(s), 14 post(s) 6/29/2015 2:42:28 PMby swalsh
swalsh

swalsh

7/2/2015 5:18:54 PM
Yes, I built the solution, ran it as debug instance as well and launched it in Google Chrome.
I browse to the login page and get the error.  When I remove the Test1.ascx control from the login.aspx page it works fine.
I am using your code exactly as you sent it to me.

Just  a thought....are you working in the full source version or the downloadable free version?  If the source version I am guessing that if you take the Test1 user control you sent me, download and install the free non-source version I am working in and drop the component in there you will see exactly the error I am getting.  

Thanks for all of your help

Shawn

This content has not been rated yet. 
70 Reputation 10 Total posts
slaven

slaven

7/3/2015 2:42:28 PM
Hi swalsh,

The issue you explained occurs if you do not setup MonoX Visual Studio solution correctly.
The code imarusic posted yesterday works if you follow steps explained in "MonoX\Samples\Solution\ReadMe.txt" from MonoX installation zip file.
I've tested it on downloadable free version and it worked fine.

1) Setup MonoX Visual Studio solution (as explained in ReadMe.txt)
2) Copy all files from CustomLogin.zip (imarusic post from yesterday) and paste in MonoX root folder.
3) Include Test1.ascx in Visual Studio solution.
  - You may get an error about missing reference for Ninject.Web when you build your solution. In that case, add references (Browse) "bin\Ninject.dll", "bin\Ninject.Web.dll" and "bin\Ninject.Web.Common.dll" from MonoX installation folder.
4) Open Login.aspx and change this line:
<%@ Register TagPrefix="MonoX" TagName="Login" Src="/MonoX/ModuleGallery/LoginModule.ascx" %>
to this:
<%@ Register TagPrefix="MonoX" TagName="Login" Src="/Test1.ascx" %>

Best regards,
Slaven
This content has not been rated yet. 
144 Reputation 22 Total posts
swalsh

swalsh

7/6/2015 2:07:43 PM
Hi Slaven and imarusic,

Thank you for your valuable and kind assistance with this issue.  I was able to get the user control override working this past weekend.    

Here is what I did in the hopes it will help others - Even though I went back through and set up MonoX exactly as described in the readme.txt file in the installation root, I still kept having issues with extending the Login user control and even the test1.ascx that imarusic sent did not work either.  My application would build and run just fine when I took out the test1.ascx and codebehind test1.ascx.cs file, so it was maddening.
I noticed that every time I put in the test1.ascx control into the project I always had to change the line in the example test1.ascx from CodeBehind="Test1.ascx.cs" to CodeFile="Test1.ascx.cs", which did not seem right to me so I started Googling the issue.

It turns out that even when MonoX is set up correctly, because there is not a .sln file included in the installation root, Visual Studio 2013 by default opens the MonoX installation as a WEB SITE, not a WEB APPLICATION.  This is wrong, wrong, wrong and is the reason my tests were failing.   It needs to run as a web application.    

Despite my best efforts I could not get VSS 2013 to open it as a web application.     So....I used VSS 2013 to create a brand new <empty> web application (not web site), made sure it compiled OK, then copied the MonoX files into the new web application directory and included all of the MonoX files and folders with it.  I compiled it and made sure it ran, then went through the installation pages to install it on my server.   When I put in the Test1.ascx user control example into the solution I found I did not need to change the CodeBehind to CodeFile - then I changed the reference to the user control in Login.aspx to the  new Test1.ascx control and it worked like a charm.

The key I found is to always run it as a web application, not a web site.  I'm sure this is in the documentation somewhere but again by default VSS2013 wants to open it as a web site.  If you don't see a 'PROJECT' option in the VSS 2013 menu bar it is opened as a web site and not an application.

I think it would be helpful to include a .sln solution file in the build that configures it as an application and not a site - so other folks can avoid the behavior and frustration that I did.

So...I am up and running and my confidence is restored.  :-)     Thanks again for your kindness and assistance.

Regards
Shawn 

This content has not been rated yet. 
70 Reputation 10 Total posts
imarusic

imarusic

7/7/2015 7:06:59 AM
Hi Shawn,

we are truly glad that you managed to make it work by yourself. We will check and cosider  your notes above.

Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
1 2