# How To Set A Connection In Lock

**URL:** <https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142>\
**Category:** Get Help\
**Tags:** connections, lock\
**Created:** [April 7, 2017, 3:11am UTC](https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142 "2017-04-07T03:11:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Havlick](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Ryan\_Havlick](https://community.auth0.com/u/Ryan_Havlick)\
**Post date:** [April 7, 2017, 3:11am UTC](https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142/1 "2017-04-07T03:11:43Z")

</div>

Hello,

I’m trying to embed lock on an [ASP.NET](http://ASP.NET) Web Forms page, and I’m trying to specify the connection that the users would log into from that page. Right now, Lock is defaulting to random connection which the user isn’t associated with.

Is there a way to specify the connection in Lock?

Here is my current code:

```
<script src="https://cdn.auth0.com/js/lock/10.14/lock.min.js"></script>
<script type="text/javascript">
    var lock = new Auth0Lock('@ConfigurationManager.AppSettings"auth0:ClientId"]', '@ConfigurationManager.AppSettings"auth0:Domain"]', {
        auth: {
            redirectUrl: 'http://localhost:4987/LoginCallback.ashx'
          , responseType: 'code'
          , params: {
              scope: 'openid profile',
              allowedConnections: 'CorrectConnection'],
          }
        },
        
    });

  function signin() {
      lock.show();
  }
</script>

```

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [April 7, 2017, 11:19am UTC](https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142/2 "2017-04-07T11:19:37Z")

</div>

> Lock is defaulting to random connection

Can you clarify what you mean by this? What connection is it defaulting to? Your implementation looks correct for `allowedConnections`. Note the `,` in that line should be removed.

---

<div class="post-metadata">

**Author:** ![Ryan\_Havlick](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Ryan\_Havlick](https://community.auth0.com/u/Ryan_Havlick)\
**Post date:** [April 15, 2017, 12:25am UTC](https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142/3 "2017-04-15T00:25:57Z")

</div>

It turns out that because the client has more than 50 connections assigned to it, Lock is just picking one of the first 50 and my user is not in that first 50, so it’s not working.

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [April 17, 2017, 10:12am UTC](https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142/4 "2017-04-17T10:12:47Z")

</div>

Please see my response to your other question: [http://community.auth0.com/answers/1073/view](http://community.auth0.com/answers/1073/view)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:53am UTC](https://community.auth0.com/t/how-to-set-a-connection-in-lock/6142/5 "2018-03-02T05:53:08Z")

</div>


