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

2011-11-21 Thread H .

Ho Robert,

I have created a bug report at http://bugzilla.xamarin.com/show_bug.cgi?id=2119.


Martin



 To: mono-devel-list@lists.ximian.com
 From: robe...@gmx.net
 Date: Wed, 9 Nov 2011 18:52:26 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in 
 Linux ASP.NET app
 
 Hi Martin,
 
 please file a bug against MD's bugzilla. IIRC, MD has an integrated
 bug reporting feature.
 
 Robert
 
 On 09.11.2011 18:36, H . wrote:
 
  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.
 
 
  Greetings,
  Martin
 
 
 
  To: mono-devel-list@lists.ximian.com
  From: robe...@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,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
 
  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@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
  
 
 
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread H .

Hi Robert,

I didn't know that Linux hides certain environment 
variables from a process depending on the identity it is running in. I 
guess that the only choice for platform indepent ASP.NET apps is then to
 configure proxy settings via web.config. Alternatively, it is possible 
to set the WebClient object's Proxy property to null in case no proxies 
should be used. This is most likely valid in intranet environments. The 
current Mono/master supports both of these methods.


Best regards,
Martin



 To: mono-devel-list@lists.ximian.com
 From: robe...@gmx.net
 Date: Sat, 5 Nov 2011 11:47:51 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in 
 Linux ASP.NET app
 
 Hi Martin,
 
 On 05.11.2011 09:48, H . wrote:
 
  Hi Robert,
 
  I am using XSP2  MonoDevelop to debug.
 
 You have to restart your user session if you've changed
 the proxy settings. Being environment-based, these settings
 won't propagate to running processes.
 
 
  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?
 
 There is no standard regarding proxy configuration besides
 those two environment variables http_proxy and no_proxy.
 
 Tools that make use of proxies (wget, curl, browsers) may
 have other proprietary configurations, but at the and they
 all support these environment variables.
 
 Robert
 
 
 
  Best regards, Martin
 
 
 
  To: mono-devel-list@lists.ximian.com From: robe...@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 SystemSettingsNetwork 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@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 
 
 
  ___ Mono-devel-list
  mailing list Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread Oskar Berggren
2011/11/9 H . test051...@hotmail.com:
 Hi Robert,

 I didn't know that Linux hides certain environment variables from a process
 depending on the identity it is running in. I guess that the only choice for

It doesn't, not as such. Environment variables are inherently per
process, and this is the same in Windows. When a process is launched
it generally inherits the environment variables from its parent, with
any requested modifications.

Then it boils down to how are environment variables configured
administratively for a particular system? The concept of system-wide
and per-user environment variables is an abstraction built on the
above facility, and there is no fundamental requirement for that (e.g.
it would be possibly to build a system where they are set and applied
per executable name, or something entirely different).

In Windows there is a control panel app to set them per user or
system-wide. In Linux each distro may have different methods, but
basically any system-wide environment settings will be stored in
e.g. /etc/environment, and it then becomes the responsibility of a few
core processes to read and apply these settings to themselves during
e.g. login. Regular applications launched by the user will then
inherit them.

Concerning proxy settings with Ubuntu 10.04 as example: These are in
System-Preferences-Network Proxy. These are by default per user
(since it's under Preferences, not Administration). However, the
button Apply System-Wide is provided. Clicking that then gives me:

oskar$ cat /etc/environment
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LANG=en_US.UTF-8
http_proxy=http://ff:8080/;


oskar$ sudo su - www-data
www-data$ printenv|grep -i prox
http_proxy=http://ff:8080/


Notice how the proxy is applied also for the www-data user. However,
to make the web server see the change it would have to be restarted.
Possibly a reboot is the easiest way to ensure they are re-read.


/Oskar



 platform indepent ASP.NET apps is then to configure proxy settings via
 web.config. Alternatively, it is possible to set the WebClient object's
 Proxy property to null in case no proxies should be used. This is most
 likely valid in intranet environments. The current Mono/master supports both
 of these methods.


 Best regards,
 Martin



 To: mono-devel-list@lists.ximian.com
 From: robe...@gmx.net
 Date: Sat, 5 Nov 2011 11:47:51 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working
 in Linux ASP.NET app

 Hi Martin,

 On 05.11.2011 09:48, H . wrote:
 
  Hi Robert,
 
  I am using XSP2 MonoDevelop to debug.

 You have to restart your user session if you've changed
 the proxy settings. Being environment-based, these settings
 won't propagate to running processes.

 
  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?

 There is no standard regarding proxy configuration besides
 those two environment variables http_proxy and no_proxy.

 Tools that make use of proxies (wget, curl, browsers) may
 have other proprietary configurations, but at the and they
 all support these environment variables.

 Robert

 
 
  Best regards, Martin
 
 
 
  To: mono-devel-list@lists.ximian.com From: robe...@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 SystemSettingsNetwork 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@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 
 
 
  ___ Mono-devel-list
  mailing list Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list


 ___
 Mono

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

2011-11-09 Thread H .

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: test051...@hotmail.com
To: robe...@gmx.net; mono-devel-list@lists.ximian.com
Date: Sat, 5 Nov 2011 08:48:34 +
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@lists.ximian.com
 From: robe...@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
  SystemSettingsNetwork 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@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
  

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread Robert Jordan
Hi Martin,

 (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

It's probably the desktop environment (GNOME, KDE, etc.) that
either keeps resetting this env var or does not include it at all.

 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.

Your conclusion is wrong. See Oskar's explanation on how the
environment is inherited etc.

Robert


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread Oskar Berggren
2011/11/9 H . test051...@hotmail.com:
 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.




Weird. I just did a quick test using command line program, and this
prints the correct information when run using F5 in Monodevelop, on
Mono 2.6.7.

public static void Main(string[] args)
{
Console.WriteLine(
Environment.GetEnvironmentVariable(http_proxy));
  Console.WriteLine(  Environment.GetEnvironmentVariable(no_proxy));
}


If you try this code both when run through Monodevelop, and when
compiled and run manually from the command line, is there a
difference?

If you move your code to Application_Start in global.asax, is there a
difference? (Long shot...)

/Oskar
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread Robert Jordan
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,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

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@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread H .

Hi Oscar,

thanks for your detailed explanation.

To further clear things up, I have always used the button Apply System-Wide 
in all of my tests. The necessary environment variables should therefore be 
available system wide.


Best regards,
Martin



 From: oskar.bergg...@gmail.com
 Date: Wed, 9 Nov 2011 12:38:20 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in 
 Linux ASP.NET app
 To: test051...@hotmail.com
 CC: mono-devel-list@lists.ximian.com
 
 2011/11/9 H . test051...@hotmail.com:
  Hi Robert,
 
  I didn't know that Linux hides certain environment variables from a process
  depending on the identity it is running in. I guess that the only choice for
 
 It doesn't, not as such. Environment variables are inherently per
 process, and this is the same in Windows. When a process is launched
 it generally inherits the environment variables from its parent, with
 any requested modifications.
 
 Then it boils down to how are environment variables configured
 administratively for a particular system? The concept of system-wide
 and per-user environment variables is an abstraction built on the
 above facility, and there is no fundamental requirement for that (e.g.
 it would be possibly to build a system where they are set and applied
 per executable name, or something entirely different).
 
 In Windows there is a control panel app to set them per user or
 system-wide. In Linux each distro may have different methods, but
 basically any system-wide environment settings will be stored in
 e.g. /etc/environment, and it then becomes the responsibility of a few
 core processes to read and apply these settings to themselves during
 e.g. login. Regular applications launched by the user will then
 inherit them.
 
 Concerning proxy settings with Ubuntu 10.04 as example: These are in
 System-Preferences-Network Proxy. These are by default per user
 (since it's under Preferences, not Administration). However, the
 button Apply System-Wide is provided. Clicking that then gives me:
 
 oskar$ cat /etc/environment
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
 http_proxy=http://ff:8080/;
 
 
 oskar$ sudo su - www-data
 www-data$ printenv|grep -i prox
 http_proxy=http://ff:8080/
 
 
 Notice how the proxy is applied also for the www-data user. However,
 to make the web server see the change it would have to be restarted.
 Possibly a reboot is the easiest way to ensure they are re-read.
 
 
 /Oskar
 
 
 
  platform indepent ASP.NET apps is then to configure proxy settings via
  web.config. Alternatively, it is possible to set the WebClient object's
  Proxy property to null in case no proxies should be used. This is most
  likely valid in intranet environments. The current Mono/master supports both
  of these methods.
 
 
  Best regards,
  Martin
 
 
 
  To: mono-devel-list@lists.ximian.com
  From: robe...@gmx.net
  Date: Sat, 5 Nov 2011 11:47:51 +0100
  Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working
  in Linux ASP.NET app
 
  Hi Martin,
 
  On 05.11.2011 09:48, H . wrote:
  
   Hi Robert,
  
   I am using XSP2 MonoDevelop to debug.
 
  You have to restart your user session if you've changed
  the proxy settings. Being environment-based, these settings
  won't propagate to running processes.
 
  
   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?
 
  There is no standard regarding proxy configuration besides
  those two environment variables http_proxy and no_proxy.
 
  Tools that make use of proxies (wget, curl, browsers) may
  have other proprietary configurations, but at the and they
  all support these environment variables.
 
  Robert
 
  
  
   Best regards, Martin
  
  
  
   To: mono-devel-list@lists.ximian.com From: robe...@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 SystemSettingsNetwork 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

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

2011-11-09 Thread H .

Hi Oscar,

yes, using a command line app everything works fine. The problems are 
restricted to ASP.NET apps.

I did reboot my machine after changing proxy settings, so it shouldn't be a 
problem with inheriting the environment variables between processes. 
Furthermore I used the button Apply System-Wide in Ubuntu. I am sure, the 
environment variables are correctly set up as they are available directly on 
the command line. To be able to run xsp2 from the command line I need to extend 
my test web app.


Greetings,
Martin



 From: oskar.bergg...@gmail.com
 Date: Wed, 9 Nov 2011 14:31:04 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in 
 Linux ASP.NET app
 To: test051...@hotmail.com
 CC: mono-devel-list@lists.ximian.com
 
 2011/11/9 H . test051...@hotmail.com:
  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.
 
 
 
 
 Weird. I just did a quick test using command line program, and this
 prints the correct information when run using F5 in Monodevelop, on
 Mono 2.6.7.
 
 public static void Main(string[] args)
 {
 Console.WriteLine(
 Environment.GetEnvironmentVariable(http_proxy));
   Console.WriteLine(  Environment.GetEnvironmentVariable(no_proxy));
 }
 
 
 If you try this code both when run through Monodevelop, and when
 compiled and run manually from the command line, is there a
 difference?
 
 If you move your code to Application_Start in global.asax, is there a
 difference? (Long shot...)
 
 /Oskar
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread Oskar Berggren
In Monodevelop, have you had a look at the project options - Run -
General, where you can set environment variables used when running
through MD. Just to check to make sure nothing there is overriding
no_proxy for your web app.

/Oskar


2011/11/9 H . test051...@hotmail.com:
 Hi Oscar,

 yes, using a command line app everything works fine. The problems are
 restricted to ASP.NET apps.

 I did reboot my machine after changing proxy settings, so it shouldn't be a
 problem with inheriting the environment variables between processes.
 Furthermore I used the button Apply System-Wide in Ubuntu. I am sure, the
 environment variables are correctly set up as they are available directly on
 the command line. To be able to run xsp2 from the command line I need to
 extend my test web app.


 Greetings,
 Martin



 From: oskar.bergg...@gmail.com
 Date: Wed, 9 Nov 2011 14:31:04 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working
 in Linux ASP.NET app
 To: test051...@hotmail.com
 CC: mono-devel-list@lists.ximian.com

 2011/11/9 H . test051...@hotmail.com:
  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.
 
 


 Weird. I just did a quick test using command line program, and this
 prints the correct information when run using F5 in Monodevelop, on
 Mono 2.6.7.

 public static void Main(string[] args)
 {
 Console.WriteLine(
 Environment.GetEnvironmentVariable(http_proxy));
 Console.WriteLine( Environment.GetEnvironmentVariable(no_proxy));
 }


 If you try this code both when run through Monodevelop, and when
 compiled and run manually from the command line, is there a
 difference?

 If you move your code to Application_Start in global.asax, is there a
 difference? (Long shot...)

 /Oskar

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread H .

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.


Greetings,
Martin



 To: mono-devel-list@lists.ximian.com
 From: robe...@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,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
 
 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@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-09 Thread Robert Jordan
Hi Martin,

please file a bug against MD's bugzilla. IIRC, MD has an integrated
bug reporting feature.

Robert

On 09.11.2011 18:36, H . wrote:

 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.


 Greetings,
 Martin



 To: mono-devel-list@lists.ximian.com
 From: robe...@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,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

 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@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
   



 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-05 Thread H .

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@lists.ximian.com
 From: robe...@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
  SystemSettingsNetwork 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@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-05 Thread Robert Jordan
Hi Martin,

On 05.11.2011 09:48, H . wrote:

 Hi Robert,

 I am using XSP2  MonoDevelop to debug.

You have to restart your user session if you've changed
the proxy settings. Being environment-based, these settings
won't propagate to running processes.


 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?

There is no standard regarding proxy configuration besides
those two environment variables http_proxy and no_proxy.

Tools that make use of proxies (wget, curl, browsers) may
have other proprietary configurations, but at the and they
all support these environment variables.

Robert



 Best regards, Martin



 To: mono-devel-list@lists.ximian.com From: robe...@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 SystemSettingsNetwork 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@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list




 ___ Mono-devel-list
 mailing list Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-03 Thread H .

Environment.GetEnvironmentVariable(no_proxy) not working in Linux ASP.NET app

After configuring proxies in Ubuntu, the environment variable no_proxy contains 
the list of proxies to bypass. Using 
Environment.GetEnvironmentVariable(no_proxy) we can retrieve the content of 
this environment variable as a string. This is working fine in standard C# 
applications.

However, when calling Environment.GetEnvironmentVariable(no_proxy) within an 
ASP.NET application, the return value is always null. As a result, the current 
proxy support in Mono fails to establish the list of proxies to bypass.

I am wondering how Environment.GetEnvironmentVariable() is working behind the 
scenes. I guess the reason why it
fails in ASP.NET is related to some kind of a permission issue.

Does anybody know more about the implementation details of 
Environment.GetEnvironmentVariable() in Mono?

  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-03 Thread Robert Jordan
On 03.11.2011 13:51, H . wrote:

 Environment.GetEnvironmentVariable(no_proxy) not working in Linux
 ASP.NET app

 After configuring proxies in Ubuntu, the environment variable
 no_proxy contains the list of proxies to bypass. Using
 Environment.GetEnvironmentVariable(no_proxy) we can retrieve the
 content of this environment variable as a string. This is working
 fine in standard C# applications.

See 
https://help.ubuntu.com/community/EnvironmentVariables#System-wide_environment_variables

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-03 Thread H .

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 SystemSettingsNetwork 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.

My question is not about setting up environment variables. I need to retrieve 
the content of $no_proxy via C# in an ASP.NET app.



 To: mono-devel-list@lists.ximian.com
 From: robe...@gmx.net
 Date: Thu, 3 Nov 2011 13:58:50 +0100
 Subject: Re: [Mono-dev] Environment.GetEnvironmentVariable() not working in 
 Linux ASP.NET app
 
 On 03.11.2011 13:51, H . wrote:
 
  Environment.GetEnvironmentVariable(no_proxy) not working in Linux
  ASP.NET app
 
  After configuring proxies in Ubuntu, the environment variable
  no_proxy contains the list of proxies to bypass. Using
  Environment.GetEnvironmentVariable(no_proxy) we can retrieve the
  content of this environment variable as a string. This is working
  fine in standard C# applications.
 
 See 
 https://help.ubuntu.com/community/EnvironmentVariables#System-wide_environment_variables
 
 Robert
 
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list
  ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-03 Thread Bojan Rajkovic
On Nov 3, 2011, at 9:12 AM, 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 SystemSettingsNetwork 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.
 
 My question is not about setting up environment variables. I need to retrieve 
 the content of $no_proxy via C# in an ASP.NET app.


In all likelihood, the ASP.NET user (probably www-data, the 
Apache/Nginx/Lighttpd user) doesn't even have NO_PROXY set in its environment, 
since it doesn't make sense to set it. If you want NO_PROXY to propagate to the 
web server's environment, you'll have to edit its startup scripts to do so.

Hope that helps.

—Bojan

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-03 Thread Rafael Teixeira
Remember that Environment Variables are set per-process and inherited by
copying by child processes, so are you sure they were set before the web
server hosting your asp.net was started? If you change afterwards it won't
propagate to the service/daemon process...


Rafael Monoman Teixeira
---
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...'
Isaac Asimov
US science fiction novelist  scholar (1920 - 1992)


On Thu, Nov 3, 2011 at 10:51 AM, H . test051...@hotmail.com wrote:

  Environment.GetEnvironmentVariable(no_proxy) not working in Linux
 ASP.NET app

 After configuring proxies in Ubuntu, the environment variable no_proxy
 contains the list of proxies to bypass. Using
 Environment.GetEnvironmentVariable(no_proxy) we can retrieve the content
 of this environment variable as a string. This is working fine in standard
 C# applications.

 However, when calling Environment.GetEnvironmentVariable(no_proxy)
 within an ASP.NET application, the return value is always null. As a
 result, the current proxy support in Mono fails to establish the list of
 proxies to bypass.

 I am wondering how Environment.GetEnvironmentVariable() is working behind
 the scenes. I guess the reason why it
 fails in ASP.NET is related to some kind of a permission issue.

 Does anybody know more about the implementation details of
 Environment.GetEnvironmentVariable() in Mono?


 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2011-11-03 Thread Robert Jordan
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
 SystemSettingsNetwork 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@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list