Problem with custom MembershipProvider in SharePoint 2010 - sharepoint

I'm having a problem getting a custom membership provider to work in SharePoint. The login page is displayed, but when I enter any credentials - right or wrong - I get the following error:
The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\Root\web.config line 22)
Line 22 is where my membership provider is configured. Its also configured in the root web sites web.config (since it needs to be configured in every virtual directory). If I remove line 22, I get the error complaining about the provider not being in every web.config, so that part seems to be working.
On the same web server, I have set up a default MVC project and confirmed that the membership provider works fine. I know sharepoint is loading it at least partially, because if I make it throw an exception in the constructor, I get a different error (Exception thrown by the invocation etc.), and the login form isn't even displayed.
The DLL is built as AnyCPU, against .NET Framework 3.5, and is in the GAC. The server is running Windows 2008 R2, 64-bit.
Can anyone point me in a direction to try?

Have you entered a <SafeControl> entry for the Membership provider?

Related

Excel cannot access the file with IIS7&Windows Server 2008 R2 (64bit)

I have a web project (.NET 4) that needs to access an Excel file, but it ends up with the following error message:
Error occurred during file generation.Microsoft Excel cannot access the file 'D:\xx\xx\abc.xls'.
There are several possible reasons:
• The file name or path does not exist. (Actually it is there)
• The file is being used by another program. (It can not happen)
• The workbook you are trying to save has the same name as a currently open workbook.
In IIS7, I use DefaultAppPool with the identity "myservice" who is under the group of Administrators.
In the authentication page of my website under IIS, anonymous authentication was enabled and set to "Application pool identity" and ASP.NET impersonation was disabled.
After searching the solution for hours, I found the following but none of them work
Create folder in C:\Windows\SysWOW64\config\systemprofile\Desktop. Please refer:this
Grant rights of "myservice" in Component Services. Please refer:this
One thing strange, there is nothing in the Group of IIS_IUSRS. Is that normal? I remember at least two users (DefaultAppPool & Classic .NET AppPool).
I assume that is a permission problem of IIS, but I can not solve it.
Problem solved!!!!!!!!!! My Excel is 2010 , should create "Desktop" folder in C:\Windows\System32\config\systemprofile

Deploy Web Part Into windows server 2008 R2

I have build one employee directory webpart that gets necessary information of user from sharepoint site. i have deployed in my testing server "Windows Server 2003 and Moss2007" and it's work fine.
When i tried to deploy on my production server "Windows Server 2008 R2 with Moss2007". It give me security error.
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed."
I have also created security policy file and added reference to web.config. Still i getting same error please help on this. i am stuck here and not able to find any way to get out of this.
Thanks in advance.
Do you install your DLL into GAC? You must either install it into GAC (the solution does it for you if you specify the assembly location as GAC) or provide a custom CAS policy and register that policy in the web.config file. We usually prefer the first way, unless a customer specifically requires a custom CAS policy. This is much easier and I really doubt the security-wise effectiveness of the custom policy approach (unless your IT department actually goes over your code and examines what it can and cannot do, haven't found a department that would know how to do that)

FileNotFound Exception with Sharepoint 2010 with the SPSite Constructor

I try to instantiate a instance of SPSite on the farm server in a console app and I give in parameter the whole website (http://sp2010/). I also made sure that the account running MyApp.exe is Site Collection Administrator.
However, I can't make an instance of SPSite whatever I am trying to do. I always gives back "FileNotFoundException".
Anyone got an idea?
StackTrace:
System.IO.FileNotFoundException: The Web application at http://localhost/sandbox could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application. at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken) at Microsoft.SharePoint.SPSite..ctor(String requestUrl) at Conchango.xyzzy.GetExistingDocument(String minId, String maxId, String titleFilter) in C:\Documents and Settings\Paul\My Documents\Visual Studio 2005\Projects\xyzzy\BDC_DocReview\BDC_DocReview\DocReviewFacade.asmx.cs:line 69
When i run this app using the App Pool Identity account it works fine. However when I run this console app using a different user that is a Site Collection Admin, Farm Admin, has dbowner rights on the content database for the Sharepoint Web application.. it does not work right and gives me this Filenot Founf Exception.
The Console app uses .Net Framework 3.5 and x64 as the CPU platform.
Again this works if i use the App Pool Identity Account, but not with any other account
User running the console application needs to have at least read permission to the SharePoint databases, otherwise you will see this kind of errors
I had this problem and solved it for my console application by changing the "Platform target:" option on the "Build" properties page to "Any CPU".
NET framework you used is not matched with SharePoint 2010 Server,for example .NET 4.5 is applied, the exception will be thrown , change to .NET 3.5 , fix your issue.
If you are using MSTest, make sure that the Test Runner matches the platform you are using. See this SO post regarding targeting MSTest for your current platform.
I had to make my Windows Forms test application .NET 3.5 instead of .NET 4.5.
SP 2010 works only on x64 mode. So change your project platform target to x64.
If your service is already running in IIS, than make sure that your app pool has the property Enable 32 bit applications set to false.

An unexpected error has occurred

I have created an asp.net web application on my local machine and I am deploying it to sharepoint. For that I am refereing the following
Deploying ASP.NET Web Applications in the Windows SharePoint Services 3.0 _layouts Folder
[http://msdn.microsoft.com/en-us/library/cc297200.aspx]
Its works perfect on my local machine but when I was trying to deploy the same on clients machine it was giving me the "An unexpected error has occurred." Error.
The scenario is, There is not visual studio install on my clients machine so what I was doing is I simply copying my solution folder in 12'hives LAYOUT folder along with the bin folder. Then when I was try to access it by hitting the URL
http://[machineName]/_layouts/[MyCustomFolder]/default.aspx it was giving me the error mention above.
Can anyone help me to solve this issue..?
Thanks in advance..
Sachin
Unexpected error might be anything, You need to see what is the root cause of the Error,
Open the Web.Config file of the IIS SharePoint WebSite
Search for the CallStack and change it to CallStack="true"
Search for the CustomError and change it to CustomError="Off"
Browse the page you will get to know the actual issue that causes the error
You yourself can rectify it , it might be as simple as missing dll
Try to watch the logfiles, set logging level to maximum to be sure you see what sharepoint says about your page.
To do that, if you have access to the server:
open SharePoint Central Admin
go to Operations tab, select "Diagnostic logging"
select category 'All' and change the trace log level to 'Verbose', save changes
reset IIS server (for the purpose of a clean experiment)
open \\server\c$\Program Files\Common Files\Microsoft Shared\web server extensions\12
logs and order by modification date
try to load your webpage in /_layouts folder, see the error again
open the newest logfile you can see and search for [MyCustomFolder] name
Then post the error message here.
An unexpected error can have multiple reasons.
Go to C:\inetpub\wwwroot\wss\VirtualDirectories\80
Open Web.Config
Change
<SafeMode MaxControls=”200″ CallStack=”false”
to
<SafeMode MaxControls=”200″ CallStack=”true”
Turn off custom errors
<customErrors mode=”Off”/>
I know that is an old question but for me the fix was to stop and start again the SharePoint Web Application from IIS.

How to find the error detail on Sharepoint Services 3?

I remembered that there is a log file that you can check for Sharepoint Services 3.0. I don't remember where I can find this. The reason I ask this I have an error when implementing the new template and it works on one, but not on the other machine. The error on the page is very generic: "The template you have choosen is invalid or can not be found".
Thanks
SharePoint log files are usually in the "Logs" folder in the '12 Hive' which by default is in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Logs.
It's easier to have the error displayed completely. You can enable this by modifying the web.config.
Find the SafeMode entry in your web.config and change CallStack="false" to CallStack="true". Then find the customErrors entry and set mode to mode="Off".
Now errors will be shown as a complete ASP.NET error screen

Resources