Just follow these simple steps and you’re there:
Step 1: Creating just one DLL for your website by adding a web deployment project to it
Before you start with anything, make sure that you’ve added adequate namespaces. Also, avoid the duplications of the class name within a namespace.
The next thing is, you need to make sure that you’ve installed the Web Deployment Setup. If you’ve not already installed it, go for it first. Follow the next steps further:
- Right-click your website project and choose the option of ‘Add Web Deployment Project’ to add the project to your website solution.
- A very strong name key must be added to the website solution as it is used to sign every DLL.
- By right- clicking on ‘Deployment Project’, choose ‘Property Pages’ to set the deployment project properties.
- Now, open the ‘Output Assemblies’ tab and select the option of ‘Merge all assemblies to single assembly’. This option will be shown as a default option.
- Provide the assembly name here.
- Visit the signing tab and then select the option for ‘Enable Strong Naming’. Here, select the name key created in the above step.
- Select the ‘Mark the assemblies with AllowPartiallyTrustedCallersAttribute (APTCA)’. Now, click the OK button. By this, the DLL will be turned to ‘partially trusted’ so that they can be used by your SharePoint site.
- The assemblies that depend on the web application should be assigned strong names and so, one must use a very strong name key for say, Business Logic, Data access etc.
- The partially trusted callers must be allowed for dependency DLLs. For this, you have to open the Class Library Project’s file – Assembly.info. You can use the code: [assembly: System.Security.AllowPartiallyTrustedCallers]
- Your deployment project must be built under the Release Mode.
- Now, visit the given path where an output is put by the deployment project. Here, you will be able to locate the DLL file for web deployment in the ‘bin’ directory. The DLLs for the dependency projects like Data Access Layer and Business Layer are also copied to the same ‘bin’ folder.
After this, you can access the DLLs that are used for your SharePoint site using the similar functionality like your ASP.NET website.
If you think that you’re unable to perform any of the things explained above, you can always seek any of the cost-effective website migration services Newyork.
Step 2: Copying the DLLs from the bin folder to your SharePoint site and using the copied DLLs by tweaked web configuration of this site
Now, in this step, you will have to link the above-created DLLs in your blank SharePoint website that already exists. Some changes are also to be made in the file named web.config, of the SharePoint website.
Follow the below-mentioned steps for the same:
- First, you have to copy the contents from the ‘bin’ folder of your ASP.NET website to your SharePoint website’s ‘bin’ folder.
- Now, go to your SharePoint site’s web.config file.
- You need to add a code to the section called the PageParserPath, of the site which is mentioned below:
- The assemblies required in your SharePoint website need to be registered as ‘SafeControl’. This can be done by adding the following code in the section called the Safecontrols:
- Now, add every other dependency DLL that will be used by your site. Make sure to name these DLLs strongly and mark them as ‘AllowPartiallyTrusted’.
- Trust level must be changed from Minimal to Medium and this can be done by moving the Trust section’s Level attribute from ‘WSS_Minimal’ to ‘WSS_Medium’.>
With this, you’ve accomplished your second step of your website’s migracy from legacy to modern.
Step 3: Importing web pages from the web application with SharePoint Designer:
- Open the SharePoint site (created in the above step) in SharePoint Designer.
- Go to File, then select Import, and then File. By this, you will get an Import Dialog Box.
- Go to the ‘Add File’ option and select the ASPX page which has been created from the local folder. Make sure to pick the ASPX file instead of the ASPX page from the project. Now click the OK button. Your page will now be imported to the SharePoint site.
- By double-clicking on the page that you just imported, select ‘Split’ from the option of ‘Design/Split/Code’. This is shown in the bottom left side of the center pane.
- After this, your designer window will show an error saying: ‘The Master Page file is unable to load’. The error is shown because of the difference in the master file of the project and the one used for your SharePoint website. Here, you can use the default master page of SharePoint.
- Now, in your web page’s ‘Page’ directive, change the ‘MasterPageFile’ attribute to a certain value similar to that of your SharePoint website’s default.aspx. This attribute is shown as masterurl/default.master.
- In the next step, from the ‘Page’ directive, you need to remove the ‘CodeFile’ attribute because it is just for the purpose of Visual Studio.
- For the placeholders of your ASP.NET web page, you have to change the ContentPlaceHolderID to an appropriate and relevant placeholder that will be used by your SharePoint site.
- In the design view, the page will render with the default master page after the mapping of placeholders for your ASP.NET web page is done to master page of your SharePoint site.
- Lastly, the ‘Inherits’ attribute is to be changed to add assembly name. An assembly should be in the SharePoint site’s ‘bin’ as we added in the above-mentioned Step 2.
With all these steps followed in the right direction, you will finally get your ASP.NET site migrated to that of your SharePoint site which is now ready to run with the same aspects as before!
If you want to save yourself from the hassle of doing the migration yourself, you can simply seek the assistance of any company or professional offering the website migration service Newyork. This will help you in a faster and faultless migration of your website!