Executing a Page with DCP in SDL Tridion 2011 SP1 - tridion

I have published a ASPX page with DCP.
<html>
<head>
</head>
<body>
<tridion:ComponentPresentation runat="server" PageURI="tcm:9-5251-64" ComponentURI="tcm:9-5245" TemplateURI="tcm:9-5247-32"/>
</body>
</html>
What are the ways to execute this page, so that it renders the DCP.
I just tried browsing this page through IIS, I am getting parser error.
Unknown server tag 'tridion:ComponentPresentation'
It would be great if some one can guide me to run this page.
Thanks in Advance

Make sure you have following tag in web.config and Tridion.ContentDelivery dll in bin
<configuration>
<system.web>
<pages>
<controls>
<add tagPrefix="tridion"
namespace="Tridion.ContentDelivery.Web.UI"
assembly="Tridion.ContentDelivery" />
</controls>
</pages>
</system.web>

You need to install the 'API Server Role' for your .NET web application:
http://sdllivecontent.sdl.com/LiveContent/content/en-US/SDL_Tridion_2011_SPONE/task_FF19F86A63E246F793D64495849EDEDF
(username/password required)

Related

Ajax Sys.WebForms.PageRequestManagerServerErrorException

A little background. I have a IIS8 server. Lets call this server ABC.
In server ABC. I have two website. One is called websiteA and websiteB. they are identical website. Only subtle differences since websiteB is primary used for test and dev purpose.
Can you please help me to troubleshoot the issue on WebsiteA?
The error is a generic error:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
This error does not happen in WebsiteB. and I have compared the ASPX page to make sure they are exactly the same.
Can you help me how to troubleshoot the error 500 on the server? I don't know how...
This is the register Assembly for the ajax on top of the ASPX page:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
This is the snippet for my toolkit
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="True"></asp:ToolkitScriptManager>
Wow. I fixed this. So for kicks I start removing stuff from the page.
The first one I remove was this bit. because in less than 1 year ago I added this bit.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
Then I get a different error message:
I get this error now:
System.Web.HttpException: Maximum request length exceeded
Did some google of that error and boom! I get this stackoverflow link:
Maximum request length exceeded. I follow the suggestion and my problem goes away! Horray
and the solution is to add this in my web.config!
(the one in bold is the new stuff I added)
System.webserver is the new bit
and
executionTimeout="100000" maxRequestLength="214748364"
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" executionTimeout="100000" maxRequestLength="214748364" />
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</configuration>

.CSHTML pages will not render

I am trying to get my server to run .cshtml files. Using WebMatrix 3 I can view the pages by right clicking and selecting "view in browser", but that views through a localmachine port. If I try to access the pages from the internet, I get a 500 error.
Here is what I have done:
I made sure that MVC 3 was installed (but I keep reading that MVC is not needed for .cshtml... I made sure anywway.
I did the whole "revert to parent" / "revert to inherited" thing, which is found in many blogs.
I was getting a 404 error for a while, so I added a MIME type of "text/html" to .cshtml extension. That solved that problem, but only led to my 500 error.
I am suspecting it's something to do with my web.config file because if I remove the file, the page will show, but it reads like text.
For example (in the most basic page I could think of):
#{
var currentTime = dateTime.Now;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Testing</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
</head>
<body>
The current time is #currentTime .
</body>
</html>
The page will render like:
#{ var currentTime = dateTime.Now;} The current time is #currentTime .
Yet, I am clueless as to what should or should not be in the web.config file. I have been wracking my brain over this for close to a month...
Here is what is in the web.config file:
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add invariant="System.Data.SqlServerCe.4.0" name="Microsoft® SQL Server® Compact 4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
<appSettings>
<add key="webPages:Version" value="2.0"/>
<add key="webpages:Enabled" value="true" />
</appSettings>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
Many thanks in advance.
If I understand you correctly you are having problems running this in IIS (Internet Information Services - the built in Web server on Windows). It looks like the directory you are serving is not configured as a Web Application (but it is configured as a Virtual Directory).
To fix this:
Open IIS manager (Win + R and copy %systemroot%\system32\inetsrv\iis.msc to the run window)
Navigate to your directory in the tree on the left (probably \Sites\Default Web Site\something
Right click on it and choose "Convert to Application"
These steps should make IIS at least try to render the .cshtml.
On a separate note .cshtml (ie ASP.NET MVC) is so much more easier to learn and understand than .asp (ie simply ASP.NET)
It seems that I had an older version... this was answered here:
CSHTML rendering text only - static page?

RadControl disappear and unrecognized tag prefix

i need to enhance the application which developed by other colleagues, the source code located at share folder such as \10.1.1.1\App1
and i had map the share folder as network drive such as T: drive
my colleagues can open the apps by VS and work properly, but when i open it by VS2010, it cannot display the RadControl in Toolbox, display unrecognized tag prefix error message and cannot reference telerik function in code behind.
i had tried many methods that found on forum and website but doesn't work. e.g.
Using Caspol.exe to grant .NET applications rights to a remote ...
Caspol.exe –m –ag 1.2 –url file://\10.1.1.13/App1/* FullTrust
Caspol.exe –m –ag 1.2 –url file://\T:/* FullTrust
Add reference to web.config
Remove dll from bin folder
refer Telerik.Web.UI assembly and register the tagprefix in the web.config or directly into the page:
<system.web>
<compilation debug="false" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<pages>
<controls>
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
</controls>
</pages>
or in the aspx page:
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

C#: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both ReportingServicesWebUserInterface.dll and Microsoft.ReportViewer.WebForms.dll

Having searched a whole lot of similair posts, workarounds, I decided to make my own post.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433:
The type
'Microsoft.Reporting.WebForms.ReportViewer'
exists in both
'c:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\reportmanager\Bin\ReportingServicesWebUserInterface.dll'
and
'c:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'
Update:
Most similair posts have as a problem that their 2 conflicting DLLs have a version 8.0.0.0 and 9.0.0.0, or so. Or that they reside in the TEMPORARY folder. I do not think that my problem can be solved similairly with such posts.
On our ReportServer there exists a Report.aspx, which renders a report. I want to replace this file with my own, to modify the page layout, like so:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="WebApplication._Default" %>
<%# Register
Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms"
TagPrefix="rsweb" %>
<!DOCTYPE>
<html>
<head runat="server"></head>
<body>
<div>
<form id="reportform" runat="server">
<div>
<rsweb:ReportViewer
ID='ReportViewerRoot'
runat='server'
ProcessingMode='Remote'
Height='100%'
Width='100%'
AsyncRendering='False'
SizeToReportContent='True'
/>
</div>
</form>
</div>
</body>
</html>
This requires a reference to MS.ReportViewer.WebForms.DLL
My Project.csproj file has this:
<Reference Include="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
I was not able to uninstall any DLLs in C:\WINDOWS, because it said it was required for other applications.
I have also tried to modify web.config, adding some dependentAssemnly, but not sure what would be useful (It was useful for version differences mentioned above).
Further I have these lines in web.config:
<compilation defaultLanguage="c#" debug="false" tempDirectory="C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\RSTempFiles\">
<assemblies>
<clear />
<add assembly="ReportingServicesWebServer" />
</assemblies>
</compilation>
Thank you for your input.
I am looking forward to receiving your suggestions.
The satisfying solution!
When inserting a ReportViewer object in the aspx, the DLL reference is automatically added (and points to the GAC WebForms). I need this reference (Couldn't succeed manually referencing to GAC DLLs), then I remove the ReportViewer in the aspx. Also, I add the reference to the conflicting DLL ReportingServicesWebUserInterface.DLL. This moves the problem (error output from post) to VS, in stead of only on the SSRS Server.
When adding a new ReportViewer() I will get the error in VS.
The solution is as follows: give the none-required DLL an alias (without actually using it in code). This will tell the compiler that this DLL is not to be used when using WebForms. See picture
Report.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="MyWebApplication._Default" %>
<!DOCTYPE>
<html>
<head runat="server">
<title></title>
</head>
<body>
<div>
<div style="background-color:Red;width:100px;height:100px;">Hoi</div>
</div>
<form id="formID" runat="server">
test
</form>
<div>haha</div>
</body>
</html>
Report.aspx.cs
public partial class _Default : System.Web.UI.Page
{
ReportViewer ReportViewerRoot;
protected void Page_Load(object sender, EventArgs e)
{
AddRV();
}
public void AddRV()
{
ReportViewerRoot = new ReportViewer()
formID.Controls.Add(ReportViewerRoot);
SetReportViewer();
SetServerReport();
}
public void SetReportViewer()
{
ReportViewerRoot.ID = "ReportViewerRoot";
ReportViewerRoot.ProcessingMode = ProcessingMode.Remote;
}
private void SetServerReport()
{
ServerReport serverReport = ReportViewerRoot.ServerReport;
// Set the report server URL and report path
serverReport.ReportServerUrl = new Uri("http://localhost/reportserver");
serverReport.ReportPath = Request.QueryString["ItemPath"];
serverReport.Refresh();
}
}
Reference source: Extern alias walkthrough
I resolve my problem
To Remove the One Assembly from my Web.Config
In My Case Version 10 and 11 is comes together.
I Remove below code from by Config
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
Also a reason this may occur is if you have nested applications. ie. App2 inside of App1.
App1's web.config might mess with App2's. Make sure that they don't reference different versions of the same Assembly.
Not in this answer, but in the next answer I have put the satisfactory solution!! :)
This very solution does work too but is not satisfying concerning the development-cycle/readability/maintainability.
My Report.aspx file contains nothing but this line:
<%# Page Language="C#" AutoEventWireup="true"
CodeBehind="Report.aspx.cs" Inherits="WebApplication._Default" %>
My Report.aspx.cs does contain code such as:
HtmlGenericControl body = new HtmlGenericControl();
HtmlForm form = new HtmlForm();
ReportViewerRoot = new ReportViewer();
Controls.Add(body);
body.Controls.Add(form);
form.Controls.Add(ReportViewerRoot);
My ReportManager/Web.config contains additional tags as:
<!-- added enableSessionState -->
<pages validateRequest="false" enableSessionState="true" />
<httpModules>
<clear />
<!-- added -->
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</httpModules>
<httpHandlers>
<!-- added -->
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
P.s.:
In no way I am able to combine html-code in report.aspx with a reportviewer (neither aspx or cs).
Nor can I add the ReportViewer dynamically in the aspx by using <% AddRV(); %>
P.s.s.
The Web.config helped me solve these errors:
In remote mode, the Report Viewer control requires session state be enabled or Report Server connection information specified in the
config file.
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.
Includes in web.config a tag dependentAssembly to force the specific version:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
</dependentAssembly>
Go to
HKEY_CLASSES_ROOT\Installer\Assemblies\Global
search for the assembly and delete complete row by right click over that and choose delete.

Updated ASP.NET 3.5 to 4.0 -> Sys.WebForms.PageRequestManager is undefined

As the title indicates, I recently updated an ASP.NET 3.5 application containing UpdatePanels and similar AJAX technologies to ASP.NET 4.0. Unfortunately, the UpdatePanels work no more and full page postbacks makes it all go south.
Web.config-file
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"/>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/>
</configSections>
<system.net>
<mailSettings>
<smtp>
<network host="localhost"/>
</smtp>
</mailSettings>
</system.net>
<system.web>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" name=".ASPXFORMSAUTH" defaultUrl="~/Administration/SystemEvents.aspx"/>
</authentication>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace. -->
<customErrors mode="RemoteOnly" defaultRedirect="~/Error.aspx">
<error statusCode="401" redirect="~/Unauthorized.aspx"/>
</customErrors>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
Javascript error upon execution in Chrome:
Uncaught TypeError: Object function Function() { [native code] } has no method '_registerScript'
Uncaught TypeError: Cannot read property 'PageRequestManager' of undefined
What is there that I could've done wrong? Thank you!
Set EnablePartialRendering="false" in ScriptManager
I was having trouble with this recently as I was updating an older project and followed your steps above but it was still giving me the same error. I found that I needed to update a line in the web.config file which fixed it.
I changed:
<xhtmlConformance mode="Legacy"/>
to:
<xhtmlConformance mode="Transitional"/>
... and I've solved it myself by replacing the UpdatePanels and by removing the scripting managers.
I know this post is very old but the way I solved this problem its not given here.. So I thought its not bad to add one more way.
I tried doing
Set EnablePartialRendering="false" in ScriptManager
and it worked but then for every click the page was getting fully loaded which I didnt wanted.
so What I did is I just added a Line in Page_Load(). btnexport is button id.
ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnexport);
I first tried it outside postback but my requirements were to export even after every dropdown click which was in update panel so the button wasnt working for that.
then when I put it inside postback... voila!! It worked like a charm.
So, you can put it outside or inside postback according to your requirements.
OR
One more solution - You can do this-
You might have forgot to add trigger inside asp:updatepanel like me.
Add this inside updatepanel and voila!!
<Triggers>
<asp:PostBackTrigger ControlID="btnexport" />
</Triggers>

Resources