Jump to content

My C# and VS.NET2k8 headache thread


Recommended Posts

Well in addition to my WMI project, I've got another one, which is to create an intranet knowledgebase in C# .NET. Its been 5 years since I've worked with C# or Visual Studio, and my first time with VS 2008. I've already figured out a bunch of stuff and of course run into a bunch of headaches. My first problem just might be that I am starting out by re-learning C# again, so I am going through my books. I figure this will be a good place to start before attempting to tackle a full-on project right from the start. Honestly, I wish we could just run Apache on the server instead of IIS, and I could throw PHP and MySQL up there, this would be so much easier. On the other hand, it never hurts to learn something new.

So to start, I'm on a notebook running Windows 7 Pro x86 with Visual Studio 2008 Team Edition installed. I have created a new ASP.NET Web Application project called "gettingStarted" and currently consists of a textbox and a button. You click the button and words show up in the field. Pretty simple. If I choose to Debug -> Start without Debugging, the app runs off the IIS that was installed by VS but REALLY slow. So I changed it so I can publish to our dev webserver (see Hurtlocker in my servers) which works just fine.

1. When I go to publish the site, I choose to publish to FTP. I have to type in my credentials every time. VS remembers my login name but not the password, and there is no checkbox to remember the password. How can I set VS to not ask me for the password anymore?

I chose the option to publish the website using only the files required to run the application. At first it did not work. I had to change the web.config to allow errors to appear, and then I got to see my error. It had to do with the fact that the web.config file was sitting in the folder of the app, instead of the root of the virtual directory. The Website is like so:

C:\sites\LocalUser\skylynx\cSharp\gettingStarted

The 'skylynx' folder is the main VD, so I made the cSharp folder a subVD. I then had to move the web.config file from the 'gettingStarted' folder to the "root" which is the cSharp folder. YES I also have access to the web server itself! I can RDP in as the Administrator, so no flying blind or waiting for moronic server admins to return emails! I am the moronic server admin! :lol:

2. Any time I publish with Visual Studio, it puts the web.config file in the 'gettingStarted' folder each time. I have it set to only publish new files, but since I moved the web.config before (yet make no changes) it copies it back. I tried setting the Output property to 'Do Not Copy' but this has made no difference. How can I either change where VS keeps this file or tell it not to publish it?

Annoying as that goes, I have a real error that doesn't seem to make sense. It is entirely possible I need to make an update on the server to handle VS 2008. When I made the application in VS, I did not do any manual coding except change the Button1_Click action. But remember this works on the notebook, just not on the server.

Parser Error Message: Could not load type 'gettingStarted._Default'.

And here is the error code:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="gettingStarted._Default" %>

Line 2:

Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

And full on code: Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="gettingStarted._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Say Hello" />

</div>
</form>
</body>
</html>

And the codebehind: Default.aspx.cs

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace gettingStarted
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "Hello there!";
}
}
}

So you can see that there is not much here, and VS put in the code portions that IIS is choking on. Let me know what your ideas are! I will take a break for now, until our Enterprise Admin comes in, so I can tell him to unblock MSDN from the firewall. :realmad:

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...