Error on AddWebPart (Sharepoint 2007) - sharepoint-2007

I am trying to use the AddWebPartToZone web service call within Sharepoint 2007 to add a webpart programmatically to a webpart page. We get a soap exception (Microsoft.Sharepoint.SoapServer.SoapServerException).
The webpart i am trying to add is the original version of the Chatterbox app found on codeplex. When i try and add a content editor webpart to the same page it works perfectly.
We can add the webpart manually (Chatterbox) to the webpart page and it works fine. We have checked and the web part is added appropriately to the safe controls list in the webconfig (as it should be). So the next step is to have a quick look in the logs. The messages we get are:
Monitorable Usage: Security - Web Services: AddWebPart
Monitorable Error importing WebPart. Assembly Microsoft.SharePoint.SampleParts.ChatterBox, Version=12.0.0.0, Culture=neutral, PublicKeyToken=48e046c834625a88, TypeName. Microsoft.SharePoint.SampleParts.ChatterBox
I've tried amending the webpart XML we use on the webservice call and we get the same error message everytime. Now this looks like a permissions problem with the webpart but seeing as we have added it correctly to the safecontrols listing in the webconfig i can't see what else i can do?
Here is the webpart XML that we used:
<?xml version="1.0" encoding="utf-16"?>
<WebPart xmlns:xsd="http://schemas.microsoft.com/WebPart/v3" xmlns:xsi="http://microsoft.com/sharepoint/webpartpages" xmlns="http://schemas.microsoft.com/WebPart/v2">
<IsIncluded>true</IsIncluded>
<ZoneID>Full Page</ZoneID>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height />
<Width />
<AllowClose>True</AllowClose>
<AllowRemove>true</AllowRemove>
<AllowZoneChange>true</AllowZoneChange>
<AllowMinimize>false</AllowMinimize>
<IsVisible>true</IsVisible>
<NumComments>10</NumComments>
<UpdateInterval>5</UpdateInterval>
<AllowConnect>True</AllowConnect>
<ChromeType>Default</ChromeType>
<TitleIconImageUrl />
<Description />
<Hidden>False</Hidden>
<BackingListName>Potato</BackingListName>
<UserName />
<AllowEdit>True</AllowEdit>
<DetailLink />
<HelpLink />
<Title>ChatterBox 101</Title>
<Dir>Default</Dir>
<PartImageSmall />
<MissingAssembly />
<PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
<IsIncludedFilter />
<Assembly>ChatterBox, Version=12.0.0.0, Culture=neutral, PublicKeyToken=48e046c834625a88</Assembly>
<TypeName>Microsoft.SharePoint.SampleParts.ChatterBox</TypeName>
<ChromeState>Normal</ChromeState>
<HelpMode>Navigate</HelpMode>
</WebPart>
We have a sharepoint 2007 (MOSS) box running on Win 2003. Any help would be really appreciated as this is slowly but surely doing my head in!
thanks,
Kev

Does the user the webservice is called under (NetworkCredentials) have the permission to add the webpart to that particular page?

Related

Page not found - No umbraco document matches the url

When typing in a url that does not exist I want to display a custom 404 page however when I type in a non-existing page I am seeing a Page not found No umbraco document matches the url in the browser
At present I am to running multiple websites in one umbraco v6.2.5 application and there are multiple languages for each website for example the following:
- www.mydomain.com/en
- www.mydomain.com/de
- www.mydomain.com/fr
The config\404handlers.config consists of the following:
<?xml version="1.0" encoding="utf-8" ?>
<NotFoundHandlers>
<notFound assembly="umbraco" type="SearchForAlias" />
<notFound assembly="umbraco" type="SearchForTemplate"/>
<notFound assembly="umbraco" type="SearchForProfile"/>
<notFound assembly="uComponents.NotFoundHandlers" type="MultiSitePageNotFoundHandler" />
<notFound assembly="umbraco" type="handle404"/>
</NotFoundHandlers>
The document type and template have been created and the template has been assigned to the new 404 node but it is still not working.
I can see that the issue is related to the subdomain as when I remove these (i.e en/, de/, fr/) from the culture and hostnames the 404 page starts working but this is required to differentiate between the languages..
Can someone please suggest how I can get the 404 page to work with the subdomains, thanks!

Intercept elmah logging ASP.NET MVC [duplicate]

This question already has an answer here:
elmah error handling - store in database
(1 answer)
Closed 6 years ago.
I would like to try to intercept and do some other processing ( export a database ) when elmah raises an error.Is there a way to do that?
ELMAH exposes two events in order to do this: ErrorLog_Filtering and ErrorLog_Logged. ErrorLog_Filtering is called just before logging to the configured error log and ErrorLog_Logged is called just after. You will find documentation about error filtering on the ELMAH site. ErrorLog_Logged isn't really documented, but you can see an example of it in this article: Logging to multiple ELMAH logs.
With that said, you probably don't want to execute any long running tasks as part of ErrorLog_Logged and ErrorLog_Filtering. It will slow down your system. I'm not sure on what you are trying to achieve here by exporting a database on every error?
Yes there is way around
1.Lets Create a Project Name ElmahMvc
2.Install nuget package nuget
Install-Package Elmah.MVC
3. Raise an Exception .There you go access error log by your local url/elmah
http://localhost:20351/elmah
The saving database and Emailing is bit of configuration to take ....
Lets look at it
1.Download ELMAH script form official site
ELMAH
2.add a database named log and run the script
3.add a connection string in web.config
<connectionStrings>
<add name="elmah" connectionString="Data Source=.;Initial Catalog=log;Persist Security Info=True;User ID=sa;Password=pass" providerName="System.Data.SqlClient" />
</connectionStrings>
4.Add a elmah element in web.config
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah" />
<!--For Addtional Mail Config .Remove it if not need for mail on every error-->
<errorMail from="waltoncrm#waltonbd.com"
to="mrahman.cse32#waltonbd.com"
subject="Application Exception"
async="false"
smtpPort="25"
smtpServer="YourServer"
userName="uName"
password="pass">
</errorMail>
</elmah>
and mail additional
under System.WebServer
<system.net>
<mailSettings>
<smtp deliveryMethod ="Network">
<network host="smtp.gmail.com" port="587" userName="yourgmailEmailAddress" password="yourGmailEmailPassword" />
</smtp>
</mailSettings>
</system.net>
Download my sample project and Elmah script with Visual Studio 2013
akash365.com
Note:if you donot want to crash your program or use it in asp.net web form Static [WebMethod]
This seems perfect
try
{
//some web method code
}
catch(Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
}

WiX IIS Authentication mode on subdirectories

I'm trying to install a ASP.NET MVC web application with wix. So far so good.
Unfortunately I came up with a pretty annoying issue I don't know how to implement.
Imagine the following WebSite structure:
Default Web Site (Windows authentication)
MyApplication (Windows authentication)
WebServices (Anoynmous authentication)
As you can see the whole website can only be accessed with valid NT credentials.
But I need to set anonymous authentication on the WebServices directory.
How can I accomplish this with wix?
<DirectoryRef Id="INSTALLDIR_WEB">
<!-- Configuring app pool -->
<Component Id="Cmp_AppPool" Guid="27CE75BF-1118-4E15-9CD5-6FA973A20B45" KeyPath="yes">
<util:User Id="AppPoolUser" Domain="[APPPOOL_IDENTITYDOMAIN]" Name="[APPPOOL_IDENTITY]" Password="[APPPOOL_IDENTITYPWD]" CreateUser="no" />
<iis:WebAppPool Id="CustomAppPool" ManagedPipelineMode="[APPPOOL_PIPELINEMODE]" ManagedRuntimeVersion="[APPPOOL_ManagedRuntimeVersion]" Name="[APPPOOL_NAME]" Identity="other" User="AppPoolUser" />
</Component>
<!-- Create new WebApplication -->
<Component Id="Cmp_CreateApplication" Guid="65591914-46A9-4CB7-BF2E-9F30F4DEE3EC" KeyPath="yes">
<Condition><![CDATA[Installed OR WEBAPP_NAME <> ""]]></Condition>
<iis:WebVirtualDir Id="MyWebVirtualDir" Alias="[WEBAPP_NAME]" Directory="INSTALLDIR_WEB" WebSite="DefaultWebSite">
<iis:WebDirProperties Id="MyWebVirtDirProperties" AnonymousAccess="no" BasicAuthentication="no" WindowsAuthentication="yes" />
<iis:WebApplication Id="MyWebWebApplication" Name="[WEBAPP_NAME]" WebAppPool="CustomAppPool" />
</iis:WebVirtualDir>
</Component>
<!-- Install directly in the IIS ROOT -->
<Component Id="Cmp_SetPermissions">
<iis:WebDir Path="WebServices" DirProperties="EnableAnonymousAuth" WebSite="DefaultWebSite" Id="ServiceDir" />
</Component>
</DirectoryRef>
<iis:WebDirProperties Id="EnableAnonymousAuth" Read="yes" Write="yes" Script="yes" Execute="yes" AnonymousAccess="yes" Index="no" LogVisits="no" />
The above code successfully creates the webapplication but does not set anonymous access on the WebServices directory.
Any ideas?
Regards
Lukas
There is WebDirProperties element for WebDir.
You can set AnonymousAccess="yes" there.
Also you should also provide the user account using the AnonymousUser attribute, and determine what setting to use for the IIsControlledPassword attribute.

Annoying Error #2048: Security sandbox violation from localhost

This is my crossdomain.xml that I put in the same folder of my Web.config:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false" />
<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>
Although I can load using Security.loadPolicyFile("http://localhost:52090/crossdomain.xml").
When my swf try to comunicate with my local site (asp.net mvc) it says:
Error #2048: Security sandbox violation: http:/ /localhost:52090/Content/Swf/MyApp.swf cannot load data from localhost:52090
How do I solve that?
Since you use as3httpclientlib that based on Socket, rather than URLLoader you should setup socket policy server instead of http one (so your crossdomain.xml isn't used by flash in this case).
To setup flash policy server you can use perl script from this article http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html with policy xml suggested by #Bart Friederichs (with to-ports attribute)
Try this one:
<?xml version="1.0"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
also, if you send it yourself, make sure to send a null-character in the end.

Request scope issue in IBM portal 8.0

I have a JSR 286 portlet running in a Websphere Portal Server 8.0. There, I do a file upload and after show the results of processing. Initially my managed bean responsible to process this file has a Request Scope (#RequestScoped). When I Click in command button to upload file, the method in MB process correctly and fills a collection of results (dadosCarga attribute in MB below) that must be showed in JSP page. However, when I the page is rederized I got a stacktrace explaining that my Managed Bean class was not found (ClassNotFoundException) and results are not shown. I got the same results using ViewScoped. Just when I changed scope from Request to Session (#SessionScoped), the results are shown.
After I googled for some answer, I found this page explaining about difference between action and render request in Portlets. It was suggested to use JSF Portlet bridge. However, this page is not active anymore. There is a Portlet bridge for Apache Myfaces (IBM portal runs over MyFaces). However, I could not see how use it. Is it just put both jars (api and implementation) in WEB-INF/lib? I tried, but I got a exception when I tried load the pages in application. So I remove them.
Below, I show My Portlet configuration, Managed Bean and JSP page. Is there any alternative, a better Idea about how to deal with this? Or may be a explanation about how to use correclty MyFaces Bridge (I could not found none in its home page).
Thanks,
Rafael Afonso
Portlet configuration:
<portlet>
<portlet-name>CargaUsuarios</portlet-name>
<display-name>CargaUsuarios</display-name>
<portlet-class>com.ibm.faces20.portlet.FacesPortlet</portlet-class>
<init-param>
<name>com.ibm.faces.portlet.page.view</name>
<value>/pages/carga/cargaUsuarios.jsp</value>
</init-param>
<init-param>
<name>wps.markup</name>
<value>html</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Carga de Usuarios</title>
<short-title>Carga deUsuarios</short-title>
<keywords>Carga Usuario</keywords>
</portlet-info>
</portlet>
Manged Bean:
#ManagedBean(name = "cargaUsuariosMB")
#RequestScoped
public class CargaUsuariosMB extends AbstractMB {
private String nomeArquivo; // FIle name
private Collection<CargaUsuarioInfoBean> dadosCarga; // processing result.
public String doUploadArquivo() {
this.dadosCarga = ... // process file and receives a collection
this.nomeArquivo = ... // get uploaded file name
return null; // Return to same origin page
}
// Getters...
}
JSP page (cargaUsuarios.jsp):
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%#taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%#taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%#taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%#taglib
uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model"
prefix="portlet-client-model"%>
<%#page language="java" contentType="text/html"
pageEncoding="ISO-8859-1" session="false"%>
<portlet:defineObjects />
<portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>
<f:view>
<h2>Carga de Usuários</h2>
<h:form enctype="multipart/form-data">
<p>
<label for="arquivoCarga"> <span>File:</span> </label> <input
type="file" name="arquivoCarga" id="FileCarga" />
</p>
<br />
<br />
<h:commandButton value="Salvar File"
action="#{cargaUsuariosMB.doUploadArquivo}"></h:commandButton>
</h:form>
<h:panelGroup id="pnlProcessamento"
rendered="#{not empty cargaUsuariosMB.dadosCarga }">
<h:outputText
value="Dados do File #{cargaUsuariosMB.nomeArquivo} processados com sucesso."></h:outputText>
<br />
<h:dataTable id="tblDadosProcessamento"
columnClasses="numLinha,cpf,status"
value="#{cargaUsuariosMB.dadosCarga}" var="dadosCarga"
styleClass="dadosProcessamento" width="100%" border="1">
<%-- Show processing results. --%>
</h:dataTable>
</h:panelGroup>
<h:messages styleClass="messages" id="msgsPesquisaCadastro"
errorClass="mensagensErro" errorStyle="color: red;"></h:messages>
</f:view>
Please try adding the following in the portlet.xml and see if it works:
<container-runtime-option>
<name>javax.portlet.actionScopedRequestAttributes</name>
<value>true</value>
</container-runtime-option>
For more information please download and check the following section in Portlet V2.0 specification:
PLT.10.4.4 Runtime Option
javax.portlet.actionScopedRequestAttributes
You are right about the render and action request, JSF (or CDI) Request and ViewScoped doesn't work properly. But solution could be using JBoss Portlet Bridge which contains brand new scopes - PortletLifecycleScoped and PortletRedisplayScoped. The first will behave exactly like a RequestScope, you will find more info in the docs. However, I am not sure if will able to use these scopes in other portals except GateIn.
When you use request scope, the data needs to be carried from portlet action to portlet render phase. The data is normally carried for request scoped beans via the portlet render parameters are a String. In order to get your data saved there, your object needs to be Serializable.
Besides that, you might want to upgrade your WebSphere Application Server beneath the WebSphere Portal to version 8.0.0.6 to avoid PM79460 and Portal itself to the latest FixPack as well.
Hope this helps.
BTW: JSR286 and JEE6 do not specify how CDI shall interact with the Portlet programming model. You might want to look at JSR362 for that.
IBM uses its own portlet bridge. It is not recommended to use any bridges in addition to that.

Resources