- Login as a Superuser (or Host).
- Go to the Host Settings page.
- Go to the tab "Other Settings".
- Find the "Allowable File Extensions" field.
- Add or remove file extensions as desired to allow or disallow file types, separated by commas.
- Click "Update" at the bottom of the page to save your changes.
This blog is about the dot net technologies that I have learnt from my working experience so far.
Tuesday, January 28, 2014
How to manage File Extensions in Dotnet Nuke.
Thursday, July 26, 2012
How to drop all objects in a SQL Server Database
/* Drop all non-system stored procs */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name])
WHILE @name is not null
BEGIN
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
PRINT 'Dropped Procedure: ' + @name
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 AND [name] > @name ORDER BY [name])
END
GO
/* Drop all views */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'V' AND category = 0 ORDER BY [name])
WHILE @name IS NOT NULL
BEGIN
SELECT @SQL = 'DROP VIEW [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
PRINT 'Dropped View: ' + @name
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'V' AND category = 0 AND [name] > @name ORDER BY [name])
END
GO
/* Drop all functions */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] IN (N'FN', N'IF', N'TF', N'FS', N'FT') AND category = 0 ORDER BY [name])
WHILE @name IS NOT NULL
BEGIN
SELECT @SQL = 'DROP FUNCTION [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
PRINT 'Dropped Function: ' + @name
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] IN (N'FN', N'IF', N'TF', N'FS', N'FT') AND category = 0 AND [name] > @name ORDER BY [name])
END
GO
/* Drop all Foreign Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' ORDER BY TABLE_NAME)
WHILE @name is not null
BEGIN
SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
WHILE @constraint IS NOT NULL
BEGIN
SELECT @SQL = 'ALTER TABLE [dbo].[' + RTRIM(@name) +'] DROP CONSTRAINT ' + RTRIM(@constraint)
EXEC (@SQL)
PRINT 'Dropped FK Constraint: ' + @constraint + ' on ' + @name
SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' AND CONSTRAINT_NAME <> @constraint AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
END
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' ORDER BY TABLE_NAME)
END
GO
/* Drop all Primary Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' ORDER BY TABLE_NAME)
WHILE @name IS NOT NULL
BEGIN
SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
WHILE @constraint is not null
BEGIN
SELECT @SQL = 'ALTER TABLE [dbo].[' + RTRIM(@name) +'] DROP CONSTRAINT ' + RTRIM(@constraint)
EXEC (@SQL)
PRINT 'Dropped PK Constraint: ' + @constraint + ' on ' + @name
SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' AND CONSTRAINT_NAME <> @constraint AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
END
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' ORDER BY TABLE_NAME)
END
GO
/* Drop all tables */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'U' AND category = 0 ORDER BY [name])
WHILE @name IS NOT NULL
BEGIN
SELECT @SQL = 'DROP TABLE [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
PRINT 'Dropped Table: ' + @name
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'U' AND category = 0 AND [name] > @name ORDER BY [name])
END
GO
How to update skin through Dotnet Nuke database
Monday, September 26, 2011
How to get the current screen resolution in Silverlight
Here is the code to find out the width and height according to current screen resolution.
string width = HtmlPage.Window.Eval("screen.width").ToString();
string height = HtmlPage.Window.Eval("screen.height").ToString();
Monday, May 30, 2011
How to delete files in a directory
string dirPath = "C://XMLFiles";
//search for the xml files in the directory and delete all files
new List
Here, I am deleting all the XML files from the dirPath directory.
Monday, March 14, 2011
Module Definitions tab missing in DNN host navigation
Tuesday, December 7, 2010
Install missing templates in the installed Visual Studio templates
devenv/installvstemplates
Press Enter.
Let the processing to be completed and then open visual studio. Now all the missing templates would be visible under Visual Studio installed templates.
Wednesday, December 1, 2010
Custom Assembly in Sql Server Reporting Services (SSRS).
Firstly let me explain you how to create a custom assembly.
1. Open the Visual Studio and Create a Class library project in C# or VB (either of the langauages you are comfortable with). Say it CustomAssembly and rename Class1.cs to MyCustomClass.cs
2. Write the code in the class file e.g.
public static string LoadXML(string strenv, string Path)
{
XmlDocument xmldoc = new XmlDocument();
XmlNode node = default(XmlNode);
string XMLFilePath = Path;
XmlUrlResolver objResolver = new XmlUrlResolver();
objResolver.Credentials = CredentialCache.DefaultCredentials;
xmldoc.XmlResolver = objResolver;
xmldoc.Load(XMLFilePath);
if (strenv.ToLower() == "development")
{
node = xmldoc.SelectSingleNode("ConnectionString/Development");
}
if (node != null)
{
con = node.InnerXml;
}
return con;
}
3. Now you are done with the code part for the custom assembly.
4. Copy the assembly from the bin folder to the C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies and C:\Program Files\Microsoft SQL Server\MSRS10_50.SQLSERVER2008R2\Reporting Services\ReportServer\bin
Note: I am using SQLServer 2008 R2 here so my folder is MSRS10_50.SQLSERVER2008R2, please check your folder and place the assembly file there.
4. The next step is to use this assembly within you SSRS. To acheive this Open Visual Studio and create a new report project and a new report (Right click the project -> Add New Item -> Report). Go to Report menu and click Report Properties.On the references tab, locate the assembly and add the assembly.
5. On the code tab write the code =CustomAssembly.MyCustomClass.LoadXML("development","some path")
webPermission = new System.Net.WebPermission(System.Net.NetworkAccess.Connect, Path);
webPermission.Assert();
For security permissions you can use the following method just after the class name.
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true)]
Also, we need to change the rssrvpolicy configuration file. This file can be located under the Report server installation folder.
Open the file and add the following code snippet under the code group tag.
<IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.SQLSERVER2008R2\Reporting Services\ReportServer\bin\CustomAssembly.dll" />
</CodeGroup>
This code generally provides the Full Trust permission to our custom assembly and enables it to override any permission barrier.