You cannot return a System.Drawing.Color object from your function, because browsers only understand text. So instead, you should return a string representation of the color, be in RGB, HEX, or whatever you have.
Your method should look like this:
protected string GetRandColor() { return ColorTranslator.ToHtml(Color.Red); }
And you can set the background of your form like this:
<body style="background-color:<%=GetRandColor()%>;">
source share