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

H . test051102 at hotmail.com
Wed Nov 9 07:51:50 EST 2011


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,127.0.0.0/8,*.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

By the way, I have checked the user name of the mono process. It's the same as the currently logged in user and therefore it should have access to all environment variables. ASP.NET/Mono seems to have a problem reading the no_proxy variable while the http_proxy variable can be accessed as expected.


Best regards,
Martin



From: test051102 at hotmail.com
To: robertj at gmx.net; mono-devel-list at lists.ximian.com
Date: Sat, 5 Nov 2011 08:48:34 +0000
Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in Linux ASP.NET app








Hi Robert,

I am using XSP2 & MonoDevelop to debug.

Based on the answers I think that it might be a Linux related issue.

I have implemented extensive proxy support for WebClient and it's underlying classes in Mono/master. This code is based on the no_proxy environment variable in Linux. The question is, how can we obtain the list of proxies to bypass in Linux? Is there a consistend way to do this for standard Linux apps AND Linux ASP.NET apps?


Best regards,
Martin



> To: mono-devel-list at lists.ximian.com
> From: robertj at gmx.net
> Date: Thu, 3 Nov 2011 15:47:37 +0100
> Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in Linux ASP.NET app
> 
> On 03.11.2011 14:12, H . wrote:
> >
> > Hi Robert,
> 
> > thanks for your hints.
> >
> > The link sent describes how environment variables can be set up in
> > Ubuntu. Of course, nobody would try to manually set up environment
> > variables when trying to configure proxies. This is done by using
> > System>Settings>Network Proxy. After that, Ubuntu sets up the
> > necessary environment variables. In case of the no_proxy environment
> > variable this can be tested by issuing "echo $no_proxy" on the
> > command line.
> 
> Yes, you may see it on *your* own command line, as a normal user,
> but the web server (you didn't specify which one, so we can't help)
> may have its own environment default settings.
> 
> A common way to solve that (if Ubuntu's config tools don't
> provide a facility to set either global or web server
> specific vars) is to set this env var globally and manually.
> 
> Robert
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
 		 	   		  

_______________________________________________
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/710aaafe/attachment-0001.html 


More information about the Mono-devel-list mailing list