MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Server.TransferRequest()

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet
Author Message
Matt Winward



Joined: 15 Feb 2008
Posts: 4

PostPosted: Tue Feb 19, 2008 9:27 am    Post subject: Server.TransferRequest() Reply with quote

Hi all.

On requests for a parent web application, and when certain conditions
match, I need to load pages from a child web application. I've been
playing around with various methods, including RewritePath and
Server.Transfer, but these each have problems of their own.

Reading up on TransferRequest, this seems like the ideal solution
where the request is sent back through the IIS pipeline and the user
will see the results from the sub application, but the URL will remain
unchanged .. perfect.

The problem is that when I try this, the URL *does* get changed. I may
as well have just done a Response.Redirect! Obviously I'm doing
something wrong. Anyone know what it might be??


Thanks,

Matt

Archived from group: microsoft>public>dotnet>framework>aspnet
Back to top
View user's profile Send private message
Matt Winward



Joined: 15 Feb 2008
Posts: 4

PostPosted: Tue Feb 19, 2008 9:51 am    Post subject: Re: Server.TransferRequest() Reply with quote

I've just put together a very simple test solution with the following
files:

Default.aspx
Test.aspx
MyModule.cs

I've added MyModule to the Web.Config and made it TransferRequest to
Test.aspx.

This works perfectly and loads the content of Test.aspx under the
guise of Default.aspx. I'm not sure why this works and my main
solution doesn't, but I'll keep looking into it; I'm sure it will turn
out to be something stupidly simple!
Back to top
View user's profile Send private message
George Ter-Saakov



Joined: 08 Aug 2007
Posts: 10

PostPosted: Tue Feb 19, 2008 1:58 pm    Post subject: Re: Server.TransferRequest() Reply with quote

I would recommend using HttpContext.RewritePath
I am successfully using it.
so if you have unresolved problems let us know and we'll help you to solve
them



George.

"Matt Winward" wrote in message @q78g2000hsh.googlegroups.com...
> Hi all.
>
> On requests for a parent web application, and when certain conditions
> match, I need to load pages from a child web application. I've been
> playing around with various methods, including RewritePath and
> Server.Transfer, but these each have problems of their own.
>
> Reading up on TransferRequest, this seems like the ideal solution
> where the request is sent back through the IIS pipeline and the user
> will see the results from the sub application, but the URL will remain
> unchanged .. perfect.
>
> The problem is that when I try this, the URL *does* get changed. I may
> as well have just done a Response.Redirect! Obviously I'm doing
> something wrong. Anyone know what it might be??
>
>
> Thanks,
>
> Matt
Back to top
View user's profile Send private message
Matt Winward



Joined: 15 Feb 2008
Posts: 4

PostPosted: Tue Feb 19, 2008 12:24 pm    Post subject: Re: Server.TransferRequest() Reply with quote

Hi George.

I tried using RewritePath but ran into some problems. Basically, it
looked as though the application was still running from the root, so
all image and css paths were broken. Is there a way around this?

If I remember correctly, I think it also led to problems with the sub
application not being able to find its assemblies because it was still
working from the root and I ended up playing with assembly probing,
which didn't get very far.

After looking into this further, I've discovered it was something
silly .. I had a redirect in a handler in the sub application! I've
sorted that out and now I'm just left with some messed up image and
css paths, so I'm updating images etc to point to /SubApplication/,
which seems to be working.

So I've got the client URL as http://domain/fakefolder/ loading
http://domain/subapp/fakefolder/ and the subapp has a handler that
actually loads http://domain/subapp/default.aspx with some querystring
info.

Finally getting somewhere. Although this approach would mean upgrading
the servers to IIS7.

Can I ask why you prefer using RewritePath?
Back to top
View user's profile Send private message
George Ter-Saakov



Joined: 08 Aug 2007
Posts: 10

PostPosted: Tue Feb 19, 2008 3:54 pm    Post subject: Re: Server.TransferRequest() Reply with quote

I see now...
You can not go outside of application scope with RewritePath.

you are going to face a problem with postback.
Try to add form and a button. Then click a button....

Check the URL in your address bar... You will see the problem.
the reason is that ASP.NET grabs a current url and put it into action
property.
So your form tag will look like
which is probably not what
you want..

There are 2 solutions
1. Create your own class derived from HtmlForm and us it.
2. RewritePath back. Then form will have rewritten path in the action
property.
Althoug i am not sure you will be able to rewrite it to
http://domain/fakefolder/



George.



"Matt Winward" wrote in message @p43g2000hsc.googlegroups.com...
> Hi George.
>
> I tried using RewritePath but ran into some problems. Basically, it
> looked as though the application was still running from the root, so
> all image and css paths were broken. Is there a way around this?
>
> If I remember correctly, I think it also led to problems with the sub
> application not being able to find its assemblies because it was still
> working from the root and I ended up playing with assembly probing,
> which didn't get very far.
>
> After looking into this further, I've discovered it was something
> silly .. I had a redirect in a handler in the sub application! I've
> sorted that out and now I'm just left with some messed up image and
> css paths, so I'm updating images etc to point to /SubApplication/,
> which seems to be working.
>
> So I've got the client URL as http://domain/fakefolder/ loading
> http://domain/subapp/fakefolder/ and the subapp has a handler that
> actually loads http://domain/subapp/default.aspx with some querystring
> info.
>
> Finally getting somewhere. Although this approach would mean upgrading
> the servers to IIS7.
>
> Can I ask why you prefer using RewritePath?
Back to top
View user's profile Send private message
Matt Winward



Joined: 15 Feb 2008
Posts: 4

PostPosted: Tue Feb 19, 2008 1:15 pm    Post subject: Re: Server.TransferRequest() Reply with quote

If I understand you correctly, I think it's the other way around.

Let's say that a customer is called Green Gate Solutions. We provide
them with a content managed minisite and the URL is http://www.ourdomain.com/greengate.

We already have our main web application at the web root. To handle
these content managed minisites, we'll have a sub web application
called (for example) SubWebApp.

The main root application will have a module that watches the
requested URL. If it has a subfolder that matches a customer subfolder
name, then this happens in the background:

http://www.domain.com/GreenGate ====> http://www.domain.com/SubWebApp/GreenGate

Then within the SubWebApp, a handler picks up the request, sees that
the GreenGate minisite has been requested, and loads the content using
http://www.domain.com/SubWebApp/Default.aspx?rid=X where X is the ID
for the customer.

I found that RewritePath didn't really work at all. Because it thought
it was still running from the root, it lost assemblies and fell apart
completely.

I did try moving the SubWebApp up to the root, giving it a subfolder
for it's pages and using Server.Transfer() instead and this *almost*
worked. Everything was fine except for a marquee ajax control that got
very confused and I couldn't work out why.

At the moment I'm trying Server.TransferRequest on IIS7 and after
renaming loads of links I reckon it's going to work. But the big
downside is that it means waiting until we can upgrade the servers to
IIS7.

Putting the app in the root folder will mean major clashes with the
main website, and considering it has a handler that handles every aspx
request, it'll probably mean a big performance hit as well.

I'll keep you posted with any further progress, but any suggestions
are welcome! Smile

Matt

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Server Error (Resources) My ASP.NET app works with resources for loading text to the different controls (multilingual app) and everything works fine. but from time to time I have the following error. Then I have to wait for some time and my app continues working (I don't have to

ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server Greetings, I am getting this error when I try to populate a DataTable by executing a stored procedure on a SQL Server 2000 database through an ODBC in a VB.NET application: ERROR [42000] SQL Server Driver][SQL 'ABC' expec

web server connection to SQL Server - Login failed for user Cant get past the error in the subject line! I have my development machine running IIS and connecting to a database server over the network. I want to use integrated windows - so I added my anonymous user account to the database server IUSR

exe COM server ? Hi, Can anyone please tell me if in .NET it's possible to create an exe COM server ? I would like to have the possibility to create such an server because I want to use it via COM from Win32 and also be able to run it via command line. And it has to be wr

UDP server problem I am currently working on a group school project. We were having issues with our UDP server code, so we copied the example directly out of our textbook (which simply takes a sentence and converts it to lower case): import java.io.*; import
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group