Visual Basic .NET » Web Forms
Problem with Ajax.NET app behind a proxy server -- alex --


Hello all! I am having trouble deploying an Ajax.NET application behind a proxy server. The problem is that the proxy server has rules that essentially appends information to the URL. For example, the application is installed in a virtual directory with the URL being:

http://server.com/virtualdir/default.aspx 


The proxy rule exposes the site as:

http://server.com/addedbyproxy/virtualdir/default.aspx 


where "addedbyproxy" is appended to the beginning of the virtual root.

So inside the application the root is "/virtualdir" but to the internet it appears as "/addedbyproxy/virtualdir". Therefore all paths to resources (images, files, etc.) sent to the client must either be relative or if absolute, must include "/addedbyproxy/virtualdir". So I think the problem with Ajax is that Utility.RegisterRegisterTypeForAjax() writes out the path to the ashx as:



The client does not find the js since it needs to go to:



I have assumed this because I cannot browse to
"/virtualdir/ajax/MyAjaxType, AssemblyName.ashx". But when I browse to
"/addedbyproxy/virtualdir/ajax/MyAjaxType, AssemblyName.ashx" I get the js code. I looked at the source code and Utility.RegisterRegisterTypeForAjax() writes the virtual root in the src path using
"System.Web.HttpContext.Current.Request.ApplicationPath".

If anyone has a workaround it would be appreciated. Or Michael, if there is any alternative please let me know (perhaps a overload of Utility.RegisterRegisterTypeForAjax() that writes a relative path or accepts a path as an argument).

-- Michael Schwarz --


Hi,

who is adding the directory part to all the paths? Is a common ASP.NET form working correct?

Regards,
Michael
On 7/6/06, alex wrote:

Hello all! I am having trouble deploying an Ajax.NET application
behind a proxy server. The problem is that the proxy server has rules
that essentially appends information to the URL. For example, the
application is installed in a virtual directory with the URL being:

http://server.com/virtualdir/default.aspx 


The proxy rule exposes the site as:

http://server.com/addedbyproxy/virtualdir/default.aspx 


where "addedbyproxy" is appended to the beginning of the virtual root.

So inside the application the root is "/virtualdir" but to the internet
it appears as "/addedbyproxy/virtualdir". Therefore all paths to
resources (images, files, etc.) sent to the client must either be
relative or if absolute, must include "/addedbyproxy/virtualdir". So I
think the problem with Ajax is that
Utility.RegisterRegisterTypeForAjax() writes out the path to the ashx
as:



The client does not find the js since it needs to go to:



I have assumed this because I cannot browse to
"/virtualdir/ajax/MyAjaxType, AssemblyName.ashx". But when I browse to
"/addedbyproxy/virtualdir/ajax/MyAjaxType, AssemblyName.ashx" I get the
js code. I looked at the source code and
Utility.RegisterRegisterTypeForAjax() writes the virtual root in the
src path using
"System.Web.HttpContext.Current.Request.ApplicationPath".

If anyone has a workaround it would be appreciated. Or Michael, if
there is any alternative please let me know (perhaps a overload of
Utility.RegisterRegisterTypeForAjax() that writes a relative path or
accepts a path as an argument).
>

--  

Best regards | Schöne Grüße Michael

Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz 
/
http://www.schwarz-interactive.de 
/
mailto:info
-- alex --


Yes, common ASP.NET forms are working. I have added logic to our application to add the directory part to the paths with a setting in the web.config. This works only for paths we have control over. We don't have control over the Ajax.NET ouput (at least I don't think we do!). Thanks for your quick response!

Michael Schwarz wrote:
Hi,

who is adding the directory part to all the paths? Is a common ASP.NET
form working correct?

Regards,
Michael
On 7/6/06, alex wrote:
>
> Hello all! I am having trouble deploying an Ajax.NET application
> behind a proxy server. The problem is that the proxy server has rules
> that essentially appends information to the URL. For example, the
> application is installed in a virtual directory with the URL being:
>
>
http://server.com/virtualdir/default.aspx 

>
> The proxy rule exposes the site as:
>
>
http://server.com/addedbyproxy/virtualdir/default.aspx 

>
> where "addedbyproxy" is appended to the beginning of the virtual root.
>
> So inside the application the root is "/virtualdir" but to the internet
> it appears as "/addedbyproxy/virtualdir". Therefore all paths to
> resources (images, files, etc.) sent to the client must either be
> relative or if absolute, must include "/addedbyproxy/virtualdir". So I
> think the problem with Ajax is that
> Utility.RegisterRegisterTypeForAjax() writes out the path to the ashx
> as:
>
>
>
> The client does not find the js since it needs to go to:
>
>
>
> I have assumed this because I cannot browse to
> "/virtualdir/ajax/MyAjaxType, AssemblyName.ashx". But when I browse to
> "/addedbyproxy/virtualdir/ajax/MyAjaxType, AssemblyName.ashx" I get the
> js code. I looked at the source code and
> Utility.RegisterRegisterTypeForAjax() writes the virtual root in the
> src path using
> "System.Web.HttpContext.Current.Request.ApplicationPath".
>
> If anyone has a workaround it would be appreciated. Or Michael, if
> there is any alternative please let me know (perhaps a overload of
> Utility.RegisterRegisterTypeForAjax() that writes a relative path or
> accepts a path as an argument).
>
>
> >
>
--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz 
/
http://www.schwarz-interactive.de 
/
mailto:info

 

[Submit Comment]Home