The only change I needed to make to your code was to add an atsign:
xPanel.Save(@"c:\path\graphicline.png");
Without it your code would not compile. Changing that to a valid folder on my PC, I can then look at the file it generated:
Dropbox - graphicline.png[
^] As you can see, it's yellow, has the word "Text" and a green diagonal line.
But...that won't display on a webpage. Not unless you specifically tell the page to display it, which you don't!
Instead of saving the image to a file and disposing of the bitmap - which isn't a good idea in a website, as multiple users may want different pictures - You need to display the bitmap directly.
There are a lot of ways to do that, but the simplest is to add an Image control to your page and give it the bytes that make up the image:
<img ID="MyImage" runat="server" />
using (Bitmap xPanel = new Bitmap(200, 200))
{
using (Graphics objGraphicPanel = Graphics.FromImage(xPanel))
{
SolidBrush yellowBrush = new SolidBrush(Color.Yellow);
objGraphicPanel.FillRectangle(yellowBrush, 0, 0, 200, 200);
SolidBrush blackBrush = new SolidBrush(Color.Black);
Font horzFont = new Font("Verdana", 10, FontStyle.Regular);
objGraphicPanel.DrawString("Test", horzFont, blackBrush, 15, 80);
Pen colorPen = new Pen(Color.Green, 2);
objGraphicPanel.DrawLine(colorPen, 10, 100, 120, 190);
MemoryStream ms = new MemoryStream();
xPanel.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
string base64 = Convert.ToBase64String(ms.ToArray());
MyImage.Src = "data:image/gif;base64," + base64;
}
}