从webconfig获取连接字符串

从webconfig获取连接字符串

本文介绍了从webconfig获取连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建自定义.net成员资格提供程序.我了解基础知识,并使用相关方法创建了一个新的类库(因为我想重用此库).

目前,我已在web.config中注册了我的自定义提供程序,如果我在这些方法上添加了一个断点,则它们将被调用.我的问题是,如何从程序集中访问连接字符串?当我在web.config中添加我的提供程序时,我引用了一个连接字符串.这是我目前拥有的:

I am creating a custom .net membership provider. I understand the basics and have created a new class library(as I want to reuse this) with the relevant methods.

At the moment I have registered my custom provider in the web.config and if I add a break point to the methods, they are being called. My question though, is how can I access the connection string from my assembly? I reference a connection string when I add my provider in the web.config. This is what I have currently:

<add name="DWMembership" type="DWMembership.Authentication" connectionStringName="ApplicationServices"

             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"

             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"

             applicationName="/" />



任何帮助将是巨大的!在此先感谢您.



Any help would be great! Thanks in advance.

推荐答案



这篇关于从webconfig获取连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 06:46