Results 1 to 13 of 13

Thread: Changes to Global.asax.vb

  1. #1

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Resolved Changes to Global.asax.vb

    I have developed a VB.NET/ASP.NET application and am using the Global.asax.vb file to store some constants which are written to Application variables in the Application_Start event.

    In development mode, I can make changes to the values of the constants, and when I build and run the application, these changes take effect as expected.

    However, when I access my ASP application by simply navigating to my LocalHost (outside of the Visual Studio environment), any changes I make to the Global.asax.vb file are ignored.

    Why is this?
    Last edited by simonm; Apr 21st, 2005 at 06:14 AM.
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    Any changes you make to any of the .vb files in the app will be ignored unless you Ctrl+Shift+B

  3. #3

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Changes to Global.asax.vb

    Where abouts do I hit ctrl+shift+B? What does it do?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    I meant "Build Solution." Every time you change something in the .vb files, build the solution again so that it gets compiled into your DLL. Ctrl+Shift+B is a keyboard shortcut many of us use to build the solution.

  5. #5

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Changes to Global.asax.vb

    So the .vb files are not necessary to be deployed on the web server? It just uses the compiled DLL?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    Correct.

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    And the ASPX pages of course, and the Global.ASAX fiels and your user controls and web.config... and stuff.

  8. #8

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Changes to Global.asax.vb

    Do I not need to deploy anything but the compiled dlls then?

    What I really want to do is allow the administrator at each web server that hosts my web project to be able to edit the database connection details...so that I can obtain these details when my application starts and build by database connection string accordingly.

    What would be the best way to do this?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    Quote Originally Posted by simonm

    What I really want to do is allow the administrator at each web server that hosts my web project to be able to edit the database connection details...so that I can obtain these details when my application starts and build by database connection string accordingly.

    What would be the best way to do this?

    Put your connection string in your web.config file. Since it's text based, your admin can open that file in notepad, edit that line and save it.

  10. #10

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Changes to Global.asax.vb

    Funnilly enough, I tried putting something in my web.config file but wherever I tried to put the text, I got errors.

    Could you possibly explain how I can add these details to my web.config file and then also how I would access these details in VB?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    In web.config

    Code:
    <appSettings>
           <add key="ConnectionString" Value="Provider = your mom" /> 
    </appSettings>
    To access it in code,

    VB Code:
    1. Dim strConn As String
    2.  
    3.         strConn = ConfigurationSettings.AppSettings("ConnectionString")

  12. #12

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Changes to Global.asax.vb

    Ah, cheers man. You are a lifesaver!
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  13. #13
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changes to Global.asax.vb

    I know... just ask Seinfeld.

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