Mark Fitzpatrick
11/20/2002 3:48:00 PM
Give a shot at testing to see if for some reason
Request.ServerVariables["SERVER_NAME"] == null, that could at least help
pinpoint an error. You might also try using the ToString().ToUpper(), in
case for some reason it isn't treating the value as a string initially and
it blows up when trying to ToUpper() an object.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"Erik" <eolson@ArtsAndCraftsFair.com> wrote in message
news:uq9#3bJkCHA.2848@tkmsftngp10...
> In my MMIT project, the app is blowing up when I try to
> Request.ServerVariables["SERVER_NAME"]. In ASP.NET I use the below code
> into the Global.asax's Application_Start method. It determines if the app
> is running on Localhost or a production server and sets an Application
> variable which I use everywhere to determine things like which database to
> connect to.
>
> Any ideas on how I can get this information? Thanks.
>
> -------------------------------
> CODE SNIPPET
> -------------------------------
> string webServer = Request.ServerVariables["SERVER_NAME"].ToUpper();
> if(webServer == "LOCALHOST"){
> Application["IsProduction"] = false;
> }else{
> Application["IsProduction"] = true;
> }
>
>
>
>
>
>