
884 P.2d 968 (1994)
Ray SANDSTROM, Appellant (Defendant),
v.
Jodi SANDSTROM, Appellee (Plaintiff).
No. 94-132.
Supreme Court of Wyoming.
November 10, 1994.
*969 Ray Sandstrom, Pro Se.
Michael D. Zwickl, Casper, Representing appellee.
Before GOLDEN, C.J., and THOMAS, MACY, TAYLOR and LEHMAN, JJ.
MACY, Justice.
Appellant Ray Sandstrom (the husband) appeals from an order in which the district court denied his motion to dismiss and his motion to vacate orders, granted the renewed motion made by Appellee Jodi Sandstrom (the wife) for entry of a summary judgment, denied the wife's motion to strike, and quieted title to a ranch in the wife.
We affirm.

ISSUE
The husband states the issue on appeal:
Point Involved
Where the [husband] filed a motion to dismiss predicated upon a settlement agreement signed by the parties, duly notarized, and which called for the immediate dismissal of all proceedings between the parties, was the court authorized to simply ignore its terms, declare the motion not to be "timely filed," and proceed as though the agreement never existed?

FACTS
This is the second time that this quiet title action has been before the Supreme Court. Originally, the case was appealed with a related case which involved the domestication of a Florida divorce decree. In that divorce decree, title to a Fremont County ranch was awarded to the wife.
The district court granted a summary judgment in favor of the wife in the domestication action. On appeal, we affirmed the district court's summary judgment order in the domestication action, and we dismissed the husband's appeal in the quiet title action because the district court had not entered a final order in that case. Sandstrom v. Sandstrom, 880 P.2d 103 (Wyo.1994). The district court subsequently granted a summary judgment in favor of the wife which quieted title to the property in her. The husband appeals from that summary judgment.
The facts of this controversy were articulated at length in Sandstrom; consequently, we will recite only those facts which are pertinent to the issue presented in this case. 880 P.2d at 104-05. The wife filed a motion on June 14, 1993, for a summary judgment in the quiet title action. On July 26, 1993, after the husband had failed to respond to her motion within the time required by W.R.C.P. 6(c), the wife filed a motion for entry of a summary judgment. On August 6, 1993, the *970 husband filed a "Memorandum Re: Summary Judgment Motion." A hearing on the wife's motions was scheduled for September 23, 1993.
On September 22, 1993, the husband filed a motion to dismiss the wife's complaint. His motion to dismiss was predicated upon a settlement agreement. The husband asserted that he and the wife had settled all their outstanding differences, including the controversy which involved the Fremont County property, by signing the settlement agreement. On that same day, the wife filed a traverse to the motion to dismiss. The wife argued that the settlement agreement resulted from improper ex parte contacts between the husband, who was a licensed attorney, and the wife, who was represented by counsel. An affidavit executed by the wife was attached to the traverse. The wife averred that she was hospitalized at the time she signed the agreement and that the husband used undue influence in convincing her to sign it.
At the hearing, the district court indicated that it would not rule on the wife's motion for a summary judgment in the quiet title action because it was going to consider the husband's motion to dismiss at a later date. See Sandstrom, 880 P.2d at 108. The district court ordered the husband to have no further ex parte contacts with the wife.
A hearing on the husband's motion to dismiss was scheduled for March 17, 1994. Prior to the hearing, the husband filed a motion to vacate the summary judgment orders,[1] and the wife filed two motions: (1) a motion to strike the husband's motion to dismiss; and (2) a renewed motion for entry of a summary judgment in the quiet title action. After the district court held a hearing on the parties' motions, it denied the husband's motion to dismiss because the motion had not been filed in a timely manner, and it also denied his motion to vacate the summary judgment orders. The district court denied the wife's motion to strike but granted her renewed motion for entry of a summary judgment and quieted title to the Fremont County property in her.

DISCUSSION
The husband contends that, even though he did not respond in a timely manner to the wife's motion for a summary judgment, the district court erred by granting the wife's motion without considering his motion to dismiss. We disagree.
W.R.C.P. 56(c), which pertains to summary judgments, provides in part:
(c) Motion and proceedings thereon. Unless the court otherwise orders, the motion and any response and other papers relating thereto shall be served pursuant to Rule 6(c).
W.R.C.P. 6(c) states in pertinent part:
(c) Motions and motion practice.

(1) Unless these rules or an order of the court establish[es] time limitations other than those contained herein, all motions . . . shall be served at least 10 days before the hearing on the motion[s]. Except as otherwise provided in Rule 59(c), or unless the court by order permits service at some other time, a party affected by the motion may serve a response, together with affidavits, if any, at least three days prior to the hearing on the motion or within 20 days after service of the motion, whichever is earlier.
In this case, the district court did not issue any orders which changed the time in which the husband was required to respond to the wife's motion for a summary judgment. The deadlines in W.R.C.P. 6(c), therefore, applied in this case. The wife filed her motion for a summary judgment on June 14, 1993. The husband did not respond to the motion within twenty days as was required by the rule. Since the husband failed to comply with the rules of civil procedure, the district court refused to consider his motion to dismiss in determining whether the wife was entitled to have a summary judgment.

*971 "The Rules of Civil Procedure provide an orderly process for the determination of controversies. They are intended to provide notice to a party of the other's contentions, a fair opportunity to discover and develop the entire case and meet those contentions, and to avoid surpriseall to the end that a just result is more probable. To condone a practice which permits parties to simply ignore the rules will defeat their purpose."
Hickey v. Burnett, 707 P.2d 741, 744 (Wyo. 1985) (quoting Larsen v. Roberts, 676 P.2d 1046, 1048 (Wyo.1984)). Compliance with the rules of civil procedure "is mandatory, not optional." Macaraeg v. Wilson (Estate of Obra), 749 P.2d 272, 275 (Wyo.1988). The district court acted properly when it enforced the rules of civil procedure as they were written. Accord Sandstrom, 880 P.2d at 105-06.
Regardless of whether it should have taken the husband's motion to dismiss into consideration, the district court acted properly by granting a summary judgment in favor of the wife. Summary judgment is appropriate when no genuine issue of material fact exists and when the prevailing party is entitled to have a judgment as a matter of law. Lyden v. Winer, 878 P.2d 516, 518 (Wyo. 1994).
In Sandstrom, we held that the husband, who was a licensed attorney, violated Rule 4.2 of the Rules of Professional Conduct for Attorneys at Law by engaging in ex parte contacts with the wife, who was represented by counsel. 880 P.2d at 108-09. The husband admitted that he had made the contacts. The wife executed the settlement agreement as a direct result of those improper ex parte contacts.
The purpose of Rule 4.2 is to prevent adverse counsel from taking unfair advantage of parties who are represented by counsel. Communications With Person Represented By Counsel, in ABA/BNA Lawyers' Manual on Professional Conduct 71:301, 71:302 (1988). When attorneys, in violation of Rule 4.2, contact opposing parties who are represented by counsel, they undermine the representative adversarial system. In re Syfert, 550 N.E.2d 1306, 1307 (Ind.1990) (per curiam). We refuse to enforce an agreement in favor of an attorney who admittedly engaged in conduct which we consider to be unethical to obtain the agreement. As the Illinois Appellate Court stated when it was confronted with a similar situation, "[w]e will not condone such actions." Heiden v. Ottinger, 245 Ill.App.3d 612, 186 Ill.Dec. 563, 569, 616 N.E.2d 1005, 1011 (1993). The settlement agreement did not create a genuine issue of material fact because, as a matter of law, it was not enforceable against the wife.

CONCLUSION
The district court did not err when it denied the husband's motion to dismiss and granted the wife's motion for entry of a summary judgment.
Affirmed.
NOTES
[1]  The husband apparently believed that the district court had granted a summary judgment to the wife in both the domestication action and the quiet title action. He, therefore, asked the district court to set aside the orders in both cases.
