<p>Does anyone know if it is possible to display a prompt to a user/administrator when activating or installing a sharepoint feature?  </p>

<p>I am writing a custom webpart and it is connecting to a separate database, I would like to allow the administrator to select or type in a connection string when installing the .wsp file or activating the feature.</p>

<p>I am looking inside the FeatureActivated event and thinking of using the SPWebConfigModification class to actually write the connection string to the web.config files in the farm.  </p>

<p>I do not want to hand edit the web.configs or hard code the string into the DLL.</p>

<p>If you have other methods for handling connection strings inside sharepoint I would be interested in them as well.</p>

[{'answer_id': 9730, 'author': 'Daniel McPherson', 'author_id': 897, 'author_profile': 'https://Stackoverflow.com/users/897', 'pm_score': 2, 'selected': True, 'text': '<p>Unfortunately there is no way to swap to a screen where you can get user via the feature activation process. Couple of comments for you:</p>\n\n<ol>\n<li>I\'m assuming the connection string is going to be different for every installation, so there is no way you can include it directly in the Solution. </li>\n<li>I\'m assuming that you couldn\'t programmatically construct this during installation.</li>\n</ol>\n\n<p>Therefore, you need some way to get user input. Here are a couple of options:</p>\n\n<ol>\n<li>It could be a web part property, though this would mean setting it each and every time the web part was added, and you would need to then maitain those settings individually.</li>\n<li>You could build out your own _layouts settings screen (good post: <a href="http://community.zevenseas.com/Blogs/Robin/archive/2008/03/17/lcm-creating-custom-application-page-and-using-the-propertybag-more-detailed.aspx" rel="nofollow noreferrer">http://community.zevenseas.com/Blogs/Robin/archive/2008/03/17/lcm-creating-custom-application-page-and-using-the-propertybag-more-detailed.aspx</a>), and from there users can maintain the property, storing it in either the Web Property bag, or inside the Web.Config. I try to avoid using the Web.Config where I can, but if you do wish to go this route then MAKE SURE you use the SPWebConfigModification class (Read this great blog: <a href="http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32" rel="nofollow noreferrer">http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32</a>)</li>\n<li>Finally, a technique I often use is storing configuration information in a SharePoint List. Chris O\'Brien has a great framework for that here: <a href="http://www.codeplex.com/SPConfigStore" rel="nofollow noreferrer">http://www.codeplex.com/SPConfigStore</a></li>\n</ol>\n\n<p>Hope that helps,\nDaniel</p>\n'}, {'answer_id': 9838, 'author': 'Keith Sirmons', 'author_id': 1048, 'author_profile': 'https://Stackoverflow.com/users/1048', 'pm_score': 0, 'selected': False, 'text': '<p>Sounds good.  I will look at these possible solutions.</p>\n\n<p>I do not think #1 will work since I am deploying multiple webparts inside a single solution which all use the same connectionString.</p>\n\n<p>#3 sounds like a very clean solution.  I see the config items are cached so it looks like if I need to store a connection string, I will not be hit with a SP lookup each time I need that string.</p>\n\n<p><a href="http://www.codeplex.com/CKS/SourceControl/FileView.aspx?itemId=222757&amp;changeSetId=11423" rel="nofollow noreferrer">While searching for a solution I did stumble across another method.</a>  </p>\n\n<p>If you dig around their code, I looks like they have created an installer that accepts application specific values, adds the values into a FeatureTemplate.xml file and passes them to the SPFeatureReceiverProperties object in the Reciever.</p>\n\n<p>I was about to start tackling this method, but I think #3 would be better.  </p>\n\n<p>Thank you,\nKeith</p>\n'}]
['https://Stackoverflow.com/questions/8849', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1048/']