in Education by
I was wondering if there is a good way to hook into the Application_Start of a SharePoint 2007 site when developing a feature? I know I can directly edit the Global.asax file in the site root, but is there a way to do this so that it gets deployed with the feature? Thanks! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
This is actually possible, but it doesn't involve the Global.asax file. Many of Microsoft's examples demonstrate wiring code in via the Global.asax, but this is not a best-practices approach when it comes to SharePoint. Ideally, your code should get packaged as a Feature and deployed via WSP (as you already know). The key lies in implementing the code in question as an HttpModule (i.e., a type that implements the IHttpModule interface) and wiring it into the ASP.NET pipeline servicing your SharePoint application. Roughly speaking, these are the steps: Create a class that implements the IHttpModule interface. Implement the Init method in your HttpModule; this is called when the HttpApplication (in this case, the SPHttpApplication) is setup, and it gives you an opportunity to carry out processing, wire-up event delegates for other pipeline events, etc. Create an SPFeatureReceiver that will add and remove your HttpModule from target web.config files on activation and deactivation, respectively. This is carried out using the SPWebConfigModification type to update the node in target web.config files. Package all as a Feature and deploy via WSP. For more information on HttpModule development, see http://msdn.microsoft.com/en-us/library/ms227673.aspx. For some additional detail on the SPWebConfigModification type, see http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebconfigmodification.aspx. Result: a class that can handle application startup and is deployable via Feature. No manual file hacking required. I've successfully used this in a number of scenarios -- most recently with a custom caching provider (IVaryByCustomHandler) that needed to register itself for callbacks with the SPHttpApplication when it started. Though your question is a bit older, I hope this helps!

Related questions

0 votes
    I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 8, 2022 in Education by JackTerrance
0 votes
    Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 7, 2022 in Education by JackTerrance
0 votes
    Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 6, 2022 in Education by JackTerrance
0 votes
    Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 6, 2022 in Education by JackTerrance
0 votes
    Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    When you select “Existing guests only” for SharePoint, how can you add a guest to an environment? Is this through the B2B option?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    I'm new to UiPath; however, by referring a online tutorial I was able to read the whole outlook email and ... or link would help. Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    What is Cross-Site scripting and how can you fix it?...
asked Feb 16, 2021 in Technology by JackTerrance
0 votes
    I need to render a vector-only SVG without antialiasing in Qt; specifically, I don't want the resulting ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    To exert control, you mentioned intervening top to bottom. Is that with AAD at the top and SharePoint sites at the bottom?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    Would you recommend that users go through the guest user request process to allow them to share a file from SharePoint with an external person?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    You can attain a series of IP addresses allotted to a particular company using __________ site. (a) https://www. ... Security questions and answers pdf, mcq on Cyber Security pdf,...
asked Nov 2, 2021 in Education by JackTerrance
0 votes
    I have quite a big solution here with a lot of different web applications and sites, around 10-15 ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
...