Posts

Showing posts with the label Database

How to create a security ASP.NET Web API controller

 Hi, Here is a code that has base response class and use it in an ASP.NET Web API controller to send a response with a cookie and security headers. This code creates a BaseResponse<T> class with a Status property and a Data property of type T. In the Post method of MyController, a new HttpResponseMessage is created with a status of OK and the content set to a serialized BaseResponse<string>. A cookie is added to the response headers, and then several security headers are added. The X-Content-Type-Options header is set to nosniff to prevent the browser from trying to interpret content with a MIME type that doesn't match the declared type. The X-Frame-Options header is set to SAMEORIGIN to prevent the page from being displayed in a frame or iframe. The Content-Security-Policy header is set to only allow content from the same origin In this code, I've assumed that you have a service IDatabaseService with a method CheckIfExists that checks if an ID exists in the databa...

How to get the following ID in a SharePoint list

 hi... More than a decade ago .. I wrote a kwizcom blog article - how to get the following ID in a SharePoint list https://kwizcom.blogspot.com/2009/08/how-do-i-tell-what-next-list-item-id-is.html This was valid for SharePoint 2007 and 2010 for sure. I do not know when Microsoft changed the table in the database .. But now in SharePoint 2019 they have created another table AllListsAux and the code should look like this /// Get the next available item id from a list /// < name="site">site /// < name="listId">listId /// public static int SharePointListNextItemId(SPSite site, Guid listId) {     int id = -1;     SPSecurity.RunWithElevatedPrivileges(delegate ()     {         if (site.WebApplication.ContentDatabases.Count > 0)         {             string DBConnString = site.WebApplication.ContentDatabases[0].DatabaseConnectionString;           ...

Invalid column name - sql server

Image
This case that happened to me when creating SQL table column I created a SQL table column . Then I received the following message on StoredProcedure or even in Select. Invalid column name Invalid column name Invalid column name What can be problem 2 tables or one table with both columns use Stored procedures to decouple scope I wrote this query to see if there is a problem with my columns select    name  from  sys.columns  where  object_id = object_id( 'Your_Table' ) I didn't see any problem with my columns OK.... What to do Go to the table where they are added to the column, check whether it has a trigger (for each table by columns also have triggers), and if there is a table trigger, stopped him, and suddenly everything starts to work. If you open the trigger you will understand that change is copying the data to another table that there has to add the column and so on. Press CTRL+SHIFT+R   on table !!! ...

Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm

Image
Did you receive the following error when you tried to compile a project of SharePoint 2010? Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm. So - the solution is simple You should be Full Permission on the SharePoint Farm - including a data base (DB owner). After it is completed - open the visual studio as administrator. Cheers, Roi Kolbinger

How to get updates of changes to the database

Image
Have you ever encountered in developing longer and you do not remember what you did and what updated and created. No - then you can not continue reading the article. If so - and also worked with a database ... So probably you wanted to know what you did (and don't remember) Here's a query that returns all the tables,views,stored procedures and functions which have changed in the last 30 days (you can change 30 to any number) set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Author:         Roi Kolbinger -- Create date:   02/08/2008 -- Description:    Get tables,views,stored procedures and functions that modified for 30 days -- ============================================= ALTER PROCEDURE [dbo] . [GetAllDBDetails] AS BEGIN -- ======================views======================= SELECT name AS view_name   , SCHEMA_NAME ( schema_id ) ...