Results 1 to 5 of 5

Thread: Error...when running VERY simple ASP.NET page...confusing problem.

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633

    Error...when running VERY simple ASP.NET page...confusing problem.

    I create a new ASP.NET project.
    I don't add any code.
    I just run the project straight away.
    IE opens with a blank page.
    Wooohoooo it works.

    I then add a label in the web designer.
    Then I add the following simple code:
    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.    Label1.Text = "woof"
    3. End Sub
    I then re-run the project.

    The error I get is attached in the zip file.

    Now. To get round this I can do 1 of 2 things.
    I can either save the project, then run it, or in Options I can set it to save all files before I run.
    This makes the project work.
    But why?
    To run and test some code why do I have to save it?! This overwrites my old files, and I may not want the changes saved, so why am I forced to save to test my code????????

    Woka
    Attached Files Attached Files

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Because the web server isnt programmed to serve pages from memory.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045
    (NEWBIE ALERT!) Sorry I don't have a lot of time to look into this, but it MAY be similar to a problem I ran into. During the Form Load even, not all of the cotrols are necessarily created yet, and if you try to initialize a control that is not loaded, you get an error message. When I get the chance in a couple of hours, I'll look up my code and see what I did.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

  4. #4

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,633
    Originally posted by Cander
    Because the web server isnt programmed to serve pages from memory.
    True, but when I run it VS should compile the code, just not save the souce code, "text" files. Why can't it compile from memory? Why does it have to compile from the saved "text" files?

    Woof

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    No. The aspx and code behind stuff is compiled on first run of the website. Not precompiled by the IDE.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width