« Previous Next »

Thread: how to insert connection string specification config file

Last post 10-30-2009 8:05 PM by sanjos81. 8 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (9 items)

Sort Posts:

  • 10-26-2009, 9:02 PM

    • sanjos81
    • Not Ranked
    • Joined on 10-26-2009, 8:59 PM
    • Posts 5

    how to insert connection string specification config file

    Hi friends,

    In IIS 7.0 manager, under connection string option, i created a connection string.  now I want to mention this connection string information in config file. 

     could you please tell me how can we do it?

     Thanks

    Joseph

  • 10-26-2009, 9:50 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: how to insert connection string specification config file

    Is this what you are looking for?

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-27-2009, 3:41 PM In reply to

    • sanjos81
    • Not Ranked
    • Joined on 10-26-2009, 8:59 PM
    • Posts 5

    Re: how to insert connection string specification config file

    Hi Ksingla,

    Thank you for your reply.  actually i want the connection string name only to be mentioned in config file not the user name and password.  could you tell me is there any way to do that.    

     

  • 10-27-2009, 4:05 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: how to insert connection string specification config file

    I understand you want name of connection strings which are there in web.config. Is that correct? If yes, as shown in the same, rootWebConfig.ConnectionStrings.ConnectionStrings collection will have all connection strings available. You can iterate through this collection and get key names which will be the name of the connection string.

    Thanks,
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-28-2009, 1:02 PM In reply to

    • sanjos81
    • Not Ranked
    • Joined on 10-26-2009, 8:59 PM
    • Posts 5

    Re: how to insert connection string specification config file

    Hi Kanwal,

    you said iterate through connectionstrings collection to get key names which will be name of connection string.  but it is in our .net pages, right.  but still in our web.config file, we have to define connection user id and password right? 

    Actually what I want is i need to mention just only the name of connection when defining connection in web.config file.  the connectionstring is created through "create connection" option of IIS manager of IIS 7.0. in that option we are creating a connection with connection name providing username,password,server,database etc. 

    once created, only the connection name has to be placed in web.config file.  this is what I am looking for?  Could you please tell me any way to implement this?

    Thanks

    Joseph 

     

     

  • 10-28-2009, 2:29 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: how to insert connection string specification config file

    Hi Joseph.

    When you define a connectionString in IIS UI, it gets written in some web.config. You can control which web.config it gets written to but you cannot use it without having complete connectionString written in web.config. Why you want only connection string name to appear in web.config and not the connectionString itself? If you don't want to share a password with someone who wants write access to a database, you should create a separate db user for that user.

    Thanks,
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-28-2009, 3:47 PM In reply to

    • sanjos81
    • Not Ranked
    • Joined on 10-26-2009, 8:59 PM
    • Posts 5

    Re: how to insert connection string specification config file

    can we use encryption/decryption method to hide userid/password portion in web.config file

  • 10-29-2009, 5:23 AM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: how to insert connection string specification config file

    See if this works for you.

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-30-2009, 8:05 PM In reply to

    • sanjos81
    • Not Ranked
    • Joined on 10-26-2009, 8:59 PM
    • Posts 5

    Re: how to insert connection string specification config file

    Thanks Kanwal..i will try this encryption/decryption method.

Page 1 of 1 (9 items)
Microsoft Communities