Recently, Web parts are often written in the project development process. However, Web Part development and debugging are not that convenient, so I thought that I could not use user control to develop my own modules, then add the user control to the Web part? This not only improves development efficiency, but also reuses previously developed modules. The following describes in detail how to perform the operation:
1. Create a new class library project and add a reference to system. Web.
2. Add a user control to the Project
3. Compile this Web Part
4. Add a strong name for the Assembly
5. Change the build output directory to c: \ Inetpub \ wwwroot \ WSS \ virtualdirectories \ [site port number] \ _ app_bin \
6. Modify assemblyinfo. CS and add using system. Security; and [Assembly: allowpartiallytrustedcallers ()]
7. Change the properties of user control and copy to output directory to copy If newer.
8. Build the project
9. Use reflector to open the generated DLL and find the assembly information.
10. Open the c: \ Inetpub \ wwwroot \ WSS \ virtualdirectories \ [site port number] \ WEB. config file and add a line under safecontrols.
<Safecontrol Assembly = "BR. webparts. ucontroldemo1, version = 1.0.0.0, culture = neutral, publickeytoken = 1e038d98fe593539 "namespace =" BR. webparts. ucontroldemo1 "typename =" usercontrolpart "Safe =" true "/>
The Assembly information is obtained from reflector.
10. Add the Web part to the webpage.
KaneboyArticleDeploy the feature of an ascx file to the station point set using delegatecontorl.