I am facing one problem with Kendo UI server wrappers in ASP.NET MVC 4
If I use .ASPX default view It understands the
<%: Html.Kendo().Grid() %>
But at the same time If I try to add Razor view
It do not understand
#(Html.Kendo() ) systax.
I have entry in web.config as well
<namespaces>
<add namespace="Kendo.Mvc.UI" />
<httpHandlers>
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
</httpHandlers>
<handlers>
<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
Pl tell me what I must be missing and where
Thanks and Regards,
Amit
To register Kendo UI using Razor templates make sure you have the below in your Views\Web.config.
Towards the bottom of the page also details the setup in telerik's documentation.
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/asp-net-mvc-4
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory,
System.Web.Mvc, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
...
<add namespace="Kendo.Mvc"/>
<add namespace="Kendo.Mvc.UI"/>
</namespaces>
</pages>
</system.web.webPages.razor>
I also have the below in my main Web.config file.
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
...
<add assembly="Kendo.Mvc"/>
</assemblies>
</compilation>
</system.web>
Adding #using Kendo.Mvc.UI at the top of the page and it worked for me
Check if your web.config settings is in the View Folder ( web.config files) not the root Web.config
Related
I'm trying to use LINQ in a Razor view (VB syntax) and I have the following:
Model.TypeList.Select(Function(i) ...)
Syntactically, everything is correct; the statement is correct, and the Model types are defined correct. However, I get the following error within design-time:
Error 12 'Select' is not a member of 'System.Collections.Generic.List(Of TypeItem)'
Obviously Select is a LINQ extension method, but it's not supported in my view, even though the DLL reference is there, and I added it as a namespace to the web.config files... Why is this basic feature not working?
I am using ASP.NET MVC 5.0, and note I'm using a custom base page class. EDIT: In the view I am using, I have the following imports:
#Imports System.Linq
#Imports System.Collections.Generic
My root web.config file has the following:
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Linq"/>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
My views wb.config has the following:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="Custom.MvcViewPage">
<namespaces>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Linq"/>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="Custom.MvcViewPage"
userControlBaseType="Custom.MvcViewUserControl">
<controls>
<add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
Note: the app works when it runs, so this is a design-time only error.
At the top of your view file, include:
#Imports System.Linq
Update:
On further inspection, System.Linq was properly included. However, I noticed that the Web.config had different values for the targetFramework attribute on the <httpRuntime> and <compilation> elements. Setting those to both be the same, namely 4.5.1, fixed the issue.
<httpRuntime targetFramework="4.5.1" />
I just created a new project in MVC3 using EF4 code first deployed on Windows Azure.
I want to keep my "web.config" file as clean as possible because it's a little complicated to understand all tags it contains.
I notice two sections: <system.web> and <system.webServer>
The first is for IIS6 and the second for IIS7+
I do not need backward compatibility so want to delete the first.
I converted a good part of the first into the second, but I cannot find how to convert these sections:
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral />
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral />
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral />
</assemblies>
</compilation>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
How to do this so that I can delete the deprecated <system.web>?
Not all of the elements are deprecated. The two most important sections are /system.web/httpHandlers which has moved to /system.webServer/handlers and /system.web/httpModules which is now /system.webServer/modules. You shouldn't need to touch the above configuration any further as the elements within are still part of the system.web element even in IIS7. Have you tried running your site after your changes?
I have a web application with an admin panel. The admin panel is a webform project and I also have an MVC project to list products inserted in admin panel. But when I upload images to ProductImgs folder in webform project, how can I get them from MVC project? Or can I save them to the MVC project folder?
Ok so sounds like you are trying to share images between two web applications? EDIT Also you are trying to do this using Cassini (the inbuilt dev web server).
The easiest way to do this is to move your development environment to using IIS and then create a virtual directory within your mvc project in IIS that points to the images folder in your other site (on your file system). NB Moving to IIS will also have the added benefits of making your solution be more in line with how it will be deployed which IMHO is a great benefit.
Say you call this virtual directory 'images' and it has two images (image1.jpg and image2.jpg).
You can then reference these images from your mvc site by using
<img src="/images/image1.jpg" />
Here is a link on how to create Virtual Directories.
http://support.microsoft.com/kb/172138
Now i found the solution: here is the root web.config to solve this issue
<location inheritInChildApplications="false">
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
<add namespace="EkosWeb.Helpers"/>
</namespaces>
</pages>
</system.web>
</location>
I need to add inheritInChildApplications="false" to location.
I am trying to get an application (that I didn't develop) running on a windows 2008 r2 64-bit server running IIS 7.5.
I am getting the above stated error - here are more details -
The requested page cannot be accessed because the related configuration data for the page is invalid
Error Code 0x8007007e
I know that the server can access the web.config, because if I make changes to it, the error code changes.
I also know that it is a correct web.config, because it is running successfully on a different server with the same file.
Does anyone have any idea what might be causing this. The error message I am getting really doesn't tell me anything.
I have tried using FailedRequestTracing, but either I don't know how to read those logs or there is no more information there. There are also no errors in the event logs on the server.
Where else can I look to get a better idea of what is happening?
Thanks for any thoughts....
EDIT - Here is the web.config. As I said earlier, it is strange that it is working on another server. I checked to ensure are referenced assemblies are available (as according to the page here, it appear that may be the problem) in the gac.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\temp\;deleteAfterServicing=false;" />
</appSettings>
<connectionStrings>
<!-- removed for this post -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<!--<add name="IBM Informix .NET Data Provider 3.0.0" invariant="IBM.Data.Informix.3.0.0" description="IBM Informix Data Provider 3.0.0 for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.3.0.0, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>-->
</DbProviderFactories>
</system.data>
<system.web>
<httpRuntime maxRequestLength="8192" />
<customErrors mode="Off" />
<sessionState timeout="360" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear />
</namespaces>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="5000000" />
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
<tracing>
<traceFailedRequests>
<add path="*.aspx">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="400-600" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
It's a bit cheaty, but Microsoft has a page specifically about this problem ... and myriad suggestions for fixing it. Have you gone through it yet?
http://support.microsoft.com/kb/942055
Try this http://windowslivehelp.com/thread.aspx?threadid=3dd85141-a45d-44d9-a94c-3c7d13cfcd5c
I was able to get past this error by disabling compression that is applied by having wsus on the server.
See details here.
Thanks for everyone's help.
We are trying to move our reports from Visual 2008 to Visual 2010, but we are not being capable of making ASP.NET ReportViewer control work on our IIS 7.5 machines. The OS is Windows 7.
We have moved all our refernces to Microsoft.Reporting.WebForms 10.0 in code and in config files as well. Our Web.config file is the following sections regarding ReportViewer:
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>
<hostingEnvironment shutdownTimeout="30" shadowCopyBinAssemblies="false" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<authentication mode="Windows" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
<httpRuntime requestValidationMode="2.0" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="GET" name ="CrystalImageHandler" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>
When loading the aspx which contains the ReportViewer control we see only the toolbar of the Report Viewer and the rest of the page is blank. The source code of that page tells the following:
The Report Viewer Web Control HTTP
Handler has not been registered in the
application's web.config file. Add
to
the system.web/httpHandlers section of
the web.config file, or add to
the system.webServer/handlers section
for Internet Information Services 7 or
later.
We know that ReportViewer 10.0 does not work in classic mode and so the application pool is configured to be Integrated. We have tried removing the handles section from the system.web but with no luck.
Anyone could give us a clue of how to get a working configuration of an ASP.NET app with Report Viewer 10.0 over IIS 7.5?
Many thanks in advance.
Jose Antonio Arroba
We had a similar problem when moving our web page from IIS6.0 to IIS7.5 we had to move our httpH andlers from to see code sample below
<defaultDocument>
<files>
<add value="home.aspx" />
</files>
</defaultDocument>
<modules>
<add name="AccessDeniedModule" type="Senate.Leagis.Web.Common.Handlers.AccessDeniedModule, Senate.Leagis.Web, Culture=neutral, PublicKeyToken=132b49799d170825" />
</modules>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
Had the same issue this morning. It looks like your web.config handlers are fine. Hint: if you need to know they are not fine, try viewing with chrome. It tended to show me error messages IE wasn't. Anyways, I solved my problem by adding an HTTP-Handler to my IIS7.5 In IIS manager, go to Handler Mappings and register the handler. Request Path:Reserved.ReportViewerWebControl.axd, Type select the correct version, click on Request Restrictions and specify "One of the following verbs" as GET,HEAD,POST,DEBUG
You might find the ending part of here useful
Try to add
<configuration>
<system.webServer>
<handlers>
<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified" />
.......
in web.config
Source