Posts

Showing posts with the label images

IIS / ASP.NET - Run all Managed Modules for All Requests (RAMMFAR)

When initially creating an ASP.NET web application, RunAllManagedModulesForAllRequest is enabled by default. If enabled, every request that passes through the ASP.NET pipeline, is treated as a managed modules (or handlers). When all modules are managed, including static content, there are possible performance implications. If you are utilizing a distributed cache provider, such as App Fabric, an implication includes that all managed resources, including static content are passed to the distributed cache (as managed resources), which adds a level of overhead, even if not required. The solution to optimizing your web application, is to disable runAllManagedModulesForAllRequests (RAMMFAR), and add defined locations for your static resources within your web configuration file. The static resources can include but are not limited to CSS, Images, and Scripts. Firstly, you will want to add location segments for each file/folder location, within the configuration element. ... ...

SQL - Inserting Images

If there is ever a need to store images into SQL Server, it can be done in a few simple steps; you will need to create the database, the table names and insert your images. CREATE TABLE ImageResource ( ID INT(5) NOT NULL AUTO_INCREMENT, NAME NVARCHAR(255) NULL, IMAGE IMAGE NULL, PRIMARY KEY ('ID') ); Once the table has been created, you simply do the insert via the following: INSERT INTO dbo.ImageResource (NAME, IMAGE) SELECT 'LOGO_NAME' AS NAME, * FROM OPENROWSET (BULK N'C:\FILENAME.PNG', SINGLE_BLOB) AS IMAGE If the image needs to be updated, use the following: UPDATE dbo.ImageResource SET IMAGE = ( SELECT * FROM OPENROWSET(BULK N'C:\FILENAME.PNG', SINGLE_BLOB) AS IMAGE ) WHERE NAME = 'LOGO_NAME'