Wednesday, October 10, 2012

ASP Page not applying css and images


If web.config file entry below does not work:



<location path="images">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="css">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

     
Open up IIS manager and click authentication and set anonymous to application pool if your using Integrated Authentication.

Wednesday, September 26, 2012

Form Based Authentication DB Registration


To register a Database for Form-based Authentication in ASP.NET you can use the command line tool
aspnet_regsql.


aspnet_regsql.exe 

To use the To use the tool, just run'aspnet_regsql.exe'

It should be located here:
C:\%windir%\Microsoft.NET\Framework\\aspnet_regsql.exe

mine work like this:

"C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe"


Thursday, June 21, 2012

Removing multiple spaces using recursive solution

This function will replace multiple spaces into single space.

Recursive Solution:


CREATE FUNCTION [dbo].[ufn_TrimSpaces]
(
@strDetails varchar(100)
)
RETURNS varchar(100)
AS
BEGIN

WHILE CHARINDEX('  ',@strDetails) > 0
BEGIN
SET @strDetails = REPLACE(@strDetails, '  ',' ')
END
RETURN LTRIM(RTRIM(@strDetails))
END

to test:


declare @test varchar(100)
set @test = '     This is    sample   text     '

select dbo.ufn_TrimSpaces(@test)




Wednesday, June 20, 2012

Fix Restored DB backup user login account

Run the script below to fix the user account login from restored db backup.

Use
sp_change_users_login 'auto_fix' ,''

Tuesday, June 19, 2012

Restoring from backup: System.Data.SqlClient.SqlError: File cannot be restored over the existing

Restore from backup encountered error: System.Data.SqlClient.SqlError: File "" cannot be restored over the existing: 
Reissue the RESTORE statement using WITH REPLACE to overwrite pre-existing files, or WITH MOVE to identify an alternate location.

Solution: Click the option page and check the Overwrite the existing database (With Replace). see image below.




Monday, June 18, 2012

Shrink SharePoint Config Log files

1. Backup your sharepoint config log files.
2. Execute the query belowusing Microsoft SQL Server Management Studio.

Note: change to your specific sharepoint config file names.

USE SharePoint_Config
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE SharePoint_Config
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 50 MB.
DBCC SHRINKFILE (SharePoint_Config_log, 50);  -- here 2 is the file ID for trasaction log file,you can also mention the log file name (dbname_log)
GO
-- Reset the database recovery model.
ALTER DATABASE SharePoint_Config
SET RECOVERY FULL;
GO

Wednesday, January 11, 2012

SharePoint 2010 limit exceeded in BCS

Connector has throttled the response. The response from database contains more than '2000rows. The maximum number of rows that can be read through Database Connector is '2000Connector has throttled the response. The response from database contains more than '2000rows. The maximum number of rows that can be read through Database Connector is '2000

Check limit

$bcs = Get-SPService
PS C:\Users\administrator> $bcs = Get-SPServiceApplicationProxy | where{$_.G
etType().FullName -eq (`Microsoft.SharePoint.BusinessData.SharedService.' + `BdcServiceApplicationProxy')}
PS C:\Users\administrator>
PS C:\Users\administrator> $BCSThrottle = Get-SPBusinessDataCatalogThrottleConfig -Scope database -ThrottleType items -ServiceApplicationProxy $bcs
PS C:\Users\administrator>  $BCSThrottle

Scope        : Database
ThrottleType : Items
Enforced     : True
Default      : 2000
Max          : 1000000

Set Limit to 50000

PS C:\Users\administrator>  Set-SPBusinessDataCatalogThrottleConfig -Identit
y $BCSThrottle -Maximum 1000000 -Default 50000
PS C:\Users\administrator>  $BCSThrottle = Get-SPBusinessDataCatalogThrottle
Config -Scope database -ThrottleType items -ServiceApplicationProxy $bcs
PS C:\Users\administrator>
PS C:\Users\administrator>  $BCSThrottle

Scope        : Database
ThrottleType : Items
Enforced     : True
Default      : 50000
Max          : 1000000

Tuesday, January 10, 2012

Restore Lost User when restoring from full DB backup in SQL Server 2008

MS SQL Server 2008 R2

To fix user login from the restored full db run the query below

EXEC sp_change_users_login 'Auto_Fix','user1',NULL,'mypassword'