OnCollisionEnter - Enabled C#

I am trying to have something repetitively simple happen, I want the player to be able to walk through a wall with the BoxCollider set inactive, and once they pass though the collider, i want the BoxCollider to be set active and not allow them to go back though it. I have tried a few different combinations, not sure if I should use SetActive or .enabled and I am thinking that OnColissionEnter will do the trick because the wall is thin, but OnCollisionExit may be better.

I just need a little help with this problem as I cannot seem the write the correct C# code that solves my problem.

Here is what I have

 using UnityEngine; 
    using System.Collections;
    public class SetWallInactive : MonoBehaviour 
    {
       Private Void OnCollisionEnter(other)
       {
          If (other.tag = “Player”)
         {
           this.GetComponent<BoxCollider>().enabled = false;
         }
       }
    }

thank you for any help you can offer.

If I understand correctly, it would be better to create a trigger which activates a box collider of the wall.
For example: you have a wall with the box collider (inactive, so that a User can go through). Behind the wall you need to add a box collider and set the “IsTrigger” checkbox. Now you need to attach the following script to that trigger.

     using UnityEngine; 
     public class SetWallInactive : MonoBehaviour 
     {
        //this is a BoxCollider of the Wall. Attach them in the inspector
        [SerializedField] BoxCollider col_wall;

        void Awake()
        {
             //let's disable the Wall collider at Awake so that a User can go through the wall
             col_wall.enabled = false;
        }

        void OnTriggerEnter(Collider col)
        {
           if (col.tag == “Player”)
          {
            //User has touched a Trigger behind the wall. Let's activate the col_wall so that a User is not able to go back
            col_wall.enabled = true;
          }
        }
     }

After that assign the Wall collider into the “col_wall” field. I believe it should work in your case.