Web Connection
Web Control Framework Error
Gravatar is a globally recognized avatar based on your email address. Web Control Framework Error
  Doug
  All
  Jan 14, 2017 @ 01:54pm

Getting This error at top of control framework page.

< % ERROR: @ Page Language="C#" ID="test_Page" GeneratedSourceFile="~\test_Page.prg" % > < % ERROR: @ Register Assembly="WebConnectionWebControls" Namespace

This is what is in the top of my control page:

```html
<%@ Page Language="C#" 
	ID="test_Page"
	GeneratedSourceFile="~\test_Page.prg" 
%>
<%@ Register Assembly="WebConnectionWebControls" Namespace="Westwind.WebConnection.WebControls" TagPrefix="ww" %>

<!DOCTYPE html>

The page is named test.ec. Where the .ec extension is mapped to \web\bin\wc.dll Any ideas why getting this error? Also, the ww controls are not rendering.

Thanks, Doug

Gravatar is a globally recognized avatar based on your email address. re: Web Control Framework Error
  Rick Strahl
  Doug
  Jan 14, 2017 @ 02:14pm

The page is not executing as a framework page, but as a script.

Make sure you have:

*** Default for page script processing if no method exists
*** 1 - MVC Template (ExpandTemplate()) 
*** 2 - Web Control Framework Pages
*** 3 - MVC Script (ExpandScript())
nPageScriptMode = 2

in your Process class. New projects default to 3...

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Web Control Framework Error
  Doug
  Rick Strahl
  Jan 15, 2017 @ 10:23am

That did the trick, Thanks. But because this property is in the projects process class, it raises a question about mixing between template scripting and control framework method.

With the nPageScriptMode = 2, it allows control framework pages to run, but what about .ExpandScript() or .ExpandTemplate() methods?

Should I create two process classes, 1 for framework pages and 1 for scripts?

Thanks, Doug

Gravatar is a globally recognized avatar based on your email address. re: Web Control Framework Error
  Rick Strahl
  Doug
  Jan 15, 2017 @ 01:44pm

You can only have one default script map that gets handled by a process class. There's no way for Web Connection to know what your extensions are mapped to or are supposed to do, so the single default gives you that for one mapping at least. Then again most apps shouldn't be mixing modes either so it's pretty uncommon to have a mix. Multiple process classes works especially if you just set them up for the script mapping mechanism - I would try to put all code into a single class.

For everything else you need to have explicit methods that call ExpandTemplate() or ExpandScript() or even ExpandPage() from methods and the code is very simple:

FUNCTION DoSomethingTemplatey()
Response.ExpandTemplate()

FUNCTION DoSomethingScriptey()
Response.ExpandScript()

FUNCTION DoSomethingPagey()
Response.ExpandPage()

These methods figure out the current physical path and run the appropriate 'script' that underlies the page.

You can also hook into OnProcessInit() or override RouteRequest() to explicitly look for extensions and map them to the corresponding Response.ExpandXXX() method.

+++ Rick ---

© 1996-2024