Thursday 30 June 2011

C# access webservice from behind proxy

I was trying to use C# .NET desktop application to access a webservice from my office, the web-service is behind a proxy firewall, I was annoyed by seeing the following error message

"- The request failed with HTTP status 407: Proxy Authentication Required"

By googling I found a solution that enables me to disable proxy "http://stackoverflow.com/questions/2131933/http-407-proxy-authentication-error-when-calling-a-web-service"

To disable the proxy, in the App.config file add the following configuration

<system.net>
<defaultProxy enabled="false" useDefaultCredentials="false">
<proxy/>
<bypasslist/>
<module/>
</defaultProxy>
</system.net>

To enable the proxy and to use the default proxy settings(specified in IE) add this configuration in your App.config

<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy/>
<bypasslist/>
<module/>
</defaultProxy>
</system.net>

Monday 30 May 2011

Godaddy Email problem with hosted applications

My web application hosted on Godaddy can't send email messages after being uploaded there. But it works normally and can send email messages from my local machine. I tried many variations for SMTP configuration as follows but no-way for success:

1- This configuration is working from my local machine

· SMTP: smtp.mydomain.com

· Port: 25

· SSL: not enabled

· user: webmaster@mydomain.com

· password: **********

2- This configuration is not working

· SMTP: smtpout.secureserver.net

· Port: 25 or 80 or 3535 or 587

· SSL: not enabled

· Cedential user: webmaster@mydomain.com

· Cedential password: **********

3- This configuration is not working

· SMTP: smtp.secureserver.net

· Port: 25 or 80 or 3535 or 587

· SSL: not enabled

· Cedential user: webmaster@mydomain.com

· Cedential password: **********

I found the solution, and it was so old problem, since 2005, I found it in the following link:

http://forums.asp.net/t/939893.aspx/1?Problem+with+System+Net+Mail+on+GoDaddy

The problem is that SMTP-server is not smtpout.secureserver.net as Godaddy tells me. But It is relay-hosting.secureserver.net that nobody tells me at all. There is no need for user name or password, relay is open for 1000 message per day for hosted applications.

jQuery simplemodal plugin typeError: 'tagName' is null or not an object.

Many thanks for Eric's effort he made to create the great simple modal jQuery plugin.

http://www.ericmmartin.com/projects/simplemodal-demos/

I found a bug then fixed it, the bug is in $.modal.impl.create function , I think it is not new for you, where you mentioned the solution when you commented to use 'form' instead 'body' for the property appendTo.

First: the comment have to be modified to become {use '#aspnetForm'} instead of {use 'form'}
Second: in line number 344, there is still hard coding problem of the word 'body', as follows.

// add styling and attributes to the data
// append to body to get correct dimensions, then move to wrap
s.d.data = data
.attr('id', data.attr('id') || s.o.dataId)
.addClass('simplemodal-data')
.css($.extend(s.o.dataCss, {
display: 'none'
}))
.appendTo('body');


I replaced the hard coded word with s.o.appendTo object such like {.appendTo(s.o.appendTo);}, and everything goes right.


Monday 28 March 2011

Firefox problem with iframe

|
|..primery.aspx
|..rootpage.aspx
|..|-l1
     |-l2
       |-l3
         |..test.htm
|

I have HTML page (i.e. test.htm) in a website say (http://172.16.16.20), the page is deeply located into a 3rd level folder, to access the page you have to write the URL as follows (http:/172.16.16.20/l1/l2/l3/test.htm), test.htm has iframe element with src="/rootpage.aspx" like following:
..
<ifram src="/rootpage.aspx"></iframe>
..

The "rootpage.aspx" with another page named "primary.aspx" are located in the root folder of the website. And primary.aspx looks like the following:

...
<iframe src="/rootpage.aspx"></iframe>
...

If you open primery.aspx , it is normal to expect to see iframe of tset.htm that contain iframe of rootpage.aspx. That is true for all browsers except Firefox. Unfortunately, Firefox will give the following error:

The page cannot be displayed
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
Please try the following:
* Contact the Web site administrator if you believe this directory should allow execute access.
HTTP Error 403.1 - Forbidden: Execute access is denied.
Internet Information Services (IIS)
Technical Information (for support personnel)

I go to IIS&gt;&gt;website&gt;&gt;Properties&gt;&gt;HomeDirectory&gt;&gt;ApplicationSettings&gt;&gt;ExecutePermissions and make it Scripts and Executables. After that Firefox gave me the next error:

Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /l1/l2/l3/rootpage.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

From the last error message I understand that Firefox iframe.src property behaves differently than other browsers, I put "/" in front of the page name to tell the browser to go to root folder, but Firefox believes that root is relative to iframe context not browser context.

To solve the problem I modifed src="/rootpage.aspx" to become src="../../../rootpage.aspx"

Now everything goes right.