Question: Let $\Omega\subset \mathbb{R}^n$ be a bounded domain with infinitely smooth boundary. Define the Sobolev norm on $C^\infty(\bar \Omega)$
$$||u||\_{W^{1,2}}:=\sqrt{\int\_\Omega (|\nabla u|^2+u^2)dx}.$$
Let us denote by $W\_0^{1,2}$ the completion of the space of smooth compactly supported functions in $\Omega$ with respect to this norm.

> 
> Let $u\in W^{1,2}\_0\cap C(\bar \Omega)$. Is it true that $u$ vanishes on $\partial \Omega$?
> 
> 
> 

Apologies if this question is not of the research level.

Answer: 
For the sake of completeness, an expansion on the comment by Mike Miller: 

In Evans/Gariepy, Thm. 4.3.1, it is proven that if the boundary of $\Omega$ is Lipschitz, then for $1 \leq p < \infty$ there is a continuous linear trace operator $T$ from $W^{1,p}(\Omega)$ to $L^p(\Omega;\mathcal{H}\_{n-1})$ which satisfies $$Tf = f \quad \text{on $\partial \Omega$}$$ if $f \in W^{1,p}(\Omega) \cap C(\overline\Omega)$. 

Observing that $W^{1,p}\_0(\Omega)$ is a closed subspace of $W^{1,p}(\Omega)$ and taking $g \in W^{1,p}\_0(\Omega)$ and a sequence $(g\_k) \subset C\_c^\infty(\Omega)$ such that $g\_k \to g$ in the $W^{1,p}(\Omega)$ norm, we obtain $$Tg = \lim\_k Tg\_k = g\_k = 0 \quad \text{in $L^p(\partial\Omega,\mathcal{H}\_{n-1})$}.$$ Thus, if $g \in W^{1,p}\_0(\Omega) \cap C(\overline\Omega)$, then $0 = Tg = g$ everywhere on $\partial\Omega$. 

It is maybe worthwile to note (Thm. 5.3.2 in Evans/Gariepy) that $T$ is in fact given by $$Tf(x) := \lim\_{r\searrow0}\frac1{|B\_r(x) \cap \Omega|} \int\_{B\_r(x) \cap \Omega} f$$
which can be a useful thing to look at also in situations where $\partial\Omega$ is less regular.

---

*Evans, Lawrence C.; Gariepy, Ronald F.*, Measure theory and fine properties of functions, Studies in Advanced Mathematics. Boca Raton: CRC Press. viii, 268 p. (1992). [ZBL0804.28001](https://zbmath.org/?q=an:0804.28001).
The claim is true, and there are likely many different arguments. The one I like is as follows.

1. Suppose that $u \in W^{1,2}(\Omega)$. Then there is $h \in W^{1,2}(\Omega)$ which is harmonic in $\Omega$ (in the sense that $\int \langle\nabla h, \nabla v\rangle = 0$ for every $v \in W^{1,2}\_0(\Omega)$) and $h - u \in W^{1,2}\_0(\Omega)$.
2. If additionally $u \in C(\overline{\Omega})$, then $h$ is given as a Poisson integral of the boundary values of $u$. In particular, if $h = 0$ in $\Omega$, then $u = h = 0$ on $\partial \Omega$.
3. However, if $u \in W^{1,2}\_0(\Omega)$, then $h = u + (h - u) \in W^{1,2}\_0(\Omega)$, and so $\int \langle \nabla h, \nabla h\rangle = 0$, that is, $h$ is identically zero.

It follows that if $u \in C(\overline{\Omega}) \cap W^{1,2}\_0(\Omega)$, then $h = 0$ in $\Omega$ (by item 3) and consequently $u = h = 0$ on $\partial \Omega$ (by item 2).