1. An UV photodetector comprising:a substrate;
a template layer formed on the substrate;
an intrinsic AlGaN layer formed on the template layer;
a first n-type AlGaN layer and a second n-type AlGaN layer formed on the intrinsic AlGaN layer side-by-side and separated by a gap, wherein the gap exposes the intrinsic AlGaN layer;
a p-type layer formed on the second n-type AlGaN layer;
an n-type ohmic contact formed on the first n-type AlGaN layer; and
a p-type ohmic contact formed on the p-type layer, wherein the p-type ohmic contact is positively biased against the n-type ohmic contact when in use.