[Mono-dev] Environment.GetEnvironmentVariable() not working in Linux ASP.NET app

H . test051102 at hotmail.com
Wed Nov 9 12:36:18 EST 2011

Hi Robert,

your suggestion is correct. It's not a problem of Mono itself but rather a problem with MonoDevelop's debugging session.

I have extended my web app with two TextBoxes which are used to display the contents of http_proxy and no_proxy. When running the app from within MonoDevelop the TextBox associated with the no_proxy value is empty. However, if I start xsp2 from the command line, both TextBoxes are displaying the expected values. I have always used the Debug build option.

MonoDevelop is not fully resetting the environment for debugging sessions. But it definitly "resets" the no_proxy variable.

This is a very confusing and difficult to track down problem. It is especially annoying when trying to debug the new proxy support in Mono/master that I have added within the last months. It also means, that web apps which are using WebClient and it's proxy support will not work as expected within a debugging session of MonoDevelop. Maybe someone that knows more about the internals of MonoDevelop can fix this problem.


> To: mono-devel-list at lists.ximian.com
> From: robertj at gmx.net
> Date: Wed, 9 Nov 2011 15:17:36 +0100
> Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in Linux ASP.NET app
> On 09.11.2011 13:51, H . wrote:
> >
> > Hi Robert,
> >
> > I have now debugged the issue using Ubuntu Maverick/ 32 bit. I did the following:
> >
> > (1) Configure system proxy settings and reboot machine
> > (2) In terminal "echo $http_proxy" returns "http://http.proxy:8080/"; "echo $no_proxy" returns "localhost,,*.local"
> > (3) Created an ASP.NET project in MonoDevelop and entered the following code in Default.aspx.cs
> >        protected void Page_Load(object Sender, EventArgs e)
> >        {
> >               string str1=Environment.GetEnvironmentVariable("http_proxy");
> >               string str2=Environment.GetEnvironmentVariable("no_proxy");
> >
> >               string strBreak="stop";//put breakpoint at this line
> >        }
> > (4) After pressing F5, we can see that str1 contains it's expected value while str2 is null
> One more eventuality: Maybe MonoDevelop is resetting the environment
> while invoking XSP in debug mode.
> You can check this by manually invoking XSP from a terminal where you
> know that this env var is set.
> Robert
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20111109/a94cd86d/attachment.html 

More information about the Mono-devel-list mailing list