Showing posts with label paths. Show all posts
Showing posts with label paths. Show all posts

Saturday, March 24, 2012

server.execute and virtual paths

I'm trying to execute an aspx page by calling Server.Execute.
The aspx page I'm trying to execute is in a different web app from the aspx
page containing the Server.Execute statement. A slightly clearer explanation
..
Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have put
Server.Execute("Path to Page1 in WebApp1").
When I call Server.Execute(String) using "http://localhost/WebApp1/Page1.asp
x", everything works ok and Page1 pops up in a new window.
But when I try to use the same path with the overloaded version, Server.Exec
ute(String, TextWriter), I get an error saying I must pass in a virtual path
. So I pass in "../WebApp1/Page1.aspx" as the path. But now I get this error
:
The virtual path '/WebApp1/Page1.aspx.cs' maps to another application, which
is not allowed.
But I can execute the same page using Server.Execute(String) and "http://...
"!!
So, is my virtual path wrong? Or is it something else?
(I need to use the overloaded version Server.Execute(String, TextWriter) so
that I can capture the output from Page1 and NOT have it popup in a new wind
ow.)Hmmm, sorry peoples...
Forget my first post...it seems my dlls weren't recompiling correctly and Se
rver.Execute(String) plus "http://..." seemed to work cos it was using some
old code but in fact that doesn't work.
So, it seems I can't use Server.Execute to execute pages in another web app.
Is there another way to accomplish this?
Cheers, Dune
"Dune" wrote:

> I'm trying to execute an aspx page by calling Server.Execute.
> The aspx page I'm trying to execute is in a different web app from the asp
x page containing the Server.Execute statement. A slightly clearer explanati
on...
> Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have pu
t Server.Execute("Path to Page1 in WebApp1").
> When I call Server.Execute(String) using "http://localhost/WebApp1/Page1.a
spx", everything works ok and Page1 pops up in a new window.
> But when I try to use the same path with the overloaded version, Server.Ex
ecute(String, TextWriter), I get an error saying I must pass in a virtual pa
th. So I pass in "../WebApp1/Page1.aspx" as the path. But now I get this err
or:
> The virtual path '/WebApp1/Page1.aspx.cs' maps to another application, whi
ch is not allowed.
> But I can execute the same page using Server.Execute(String) and "http://.
."!!
> So, is my virtual path wrong? Or is it something else?
> (I need to use the overloaded version Server.Execute(String, TextWriter) s
o that I can capture the output from Page1 and NOT have it popup in a new wi
ndow.)
>
You're going to be stuck with Response.Redirect, I think.
Dale Preston
MCAD, MCSE, MCDBA
"Dune" <Dune@.discussions.microsoft.com> wrote in message
news:0B7B2BBD-9D95-4ACC-B5E4-8EF63726EE86@.microsoft.com...
> Hmmm, sorry peoples...
> Forget my first post...it seems my dlls weren't recompiling correctly and
Server.Execute(String) plus "http://..." seemed to work cos it was using
some old code but in fact that doesn't work.
> So, it seems I can't use Server.Execute to execute pages in another web
app.
> Is there another way to accomplish this?
> Cheers, Dune
> "Dune" wrote:
>
aspx page containing the Server.Execute statement. A slightly clearer
explanation...
put Server.Execute("Path to Page1 in WebApp1").
"http://localhost/WebApp1/Page1.aspx", everything works ok and Page1 pops up
in a new window.
Server.Execute(String, TextWriter), I get an error saying I must pass in a
virtual path. So I pass in "../WebApp1/Page1.aspx" as the path. But now I
get this error:
which is not allowed.
"http://..."!!
so that I can capture the output from Page1 and NOT have it popup in a new
window.)

server.execute and virtual paths

I'm trying to execute an aspx page by calling Server.Execute.

The aspx page I'm trying to execute is in a different web app from the aspx page containing the Server.Execute statement. A slightly clearer explanation...

Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have put Server.Execute("Path to Page1 in WebApp1").

When I call Server.Execute(String) using "http://localhost/WebApp1/Page1.aspx", everything works ok and Page1 pops up in a new window.

But when I try to use the same path with the overloaded version, Server.Execute(String, TextWriter), I get an error saying I must pass in a virtual path. So I pass in "../WebApp1/Page1.aspx" as the path. But now I get this error:

The virtual path '/WebApp1/Page1.aspx.cs' maps to another application, which is not allowed.

But I can execute the same page using Server.Execute(String) and "http://..."!!

So, is my virtual path wrong? Or is it something else?
(I need to use the overloaded version Server.Execute(String, TextWriter) so that I can capture the output from Page1 and NOT have it popup in a new window.)Hmmm, sorry peoples...

Forget my first post...it seems my dlls weren't recompiling correctly and Server.Execute(String) plus "http://..." seemed to work cos it was using some old code but in fact that doesn't work.

So, it seems I can't use Server.Execute to execute pages in another web app.
Is there another way to accomplish this?

Cheers, Dune

"Dune" wrote:

> I'm trying to execute an aspx page by calling Server.Execute.
> The aspx page I'm trying to execute is in a different web app from the aspx page containing the Server.Execute statement. A slightly clearer explanation...
> Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have put Server.Execute("Path to Page1 in WebApp1").
> When I call Server.Execute(String) using "http://localhost/WebApp1/Page1.aspx", everything works ok and Page1 pops up in a new window.
> But when I try to use the same path with the overloaded version, Server.Execute(String, TextWriter), I get an error saying I must pass in a virtual path. So I pass in "../WebApp1/Page1.aspx" as the path. But now I get this error:
> The virtual path '/WebApp1/Page1.aspx.cs' maps to another application, which is not allowed.
> But I can execute the same page using Server.Execute(String) and "http://..."!!
> So, is my virtual path wrong? Or is it something else?
> (I need to use the overloaded version Server.Execute(String, TextWriter) so that I can capture the output from Page1 and NOT have it popup in a new window.)
You're going to be stuck with Response.Redirect, I think.

Dale Preston
MCAD, MCSE, MCDBA

"Dune" <Dune@.discussions.microsoft.com> wrote in message
news:0B7B2BBD-9D95-4ACC-B5E4-8EF63726EE86@.microsoft.com...
> Hmmm, sorry peoples...
> Forget my first post...it seems my dlls weren't recompiling correctly and
Server.Execute(String) plus "http://..." seemed to work cos it was using
some old code but in fact that doesn't work.
> So, it seems I can't use Server.Execute to execute pages in another web
app.
> Is there another way to accomplish this?
> Cheers, Dune
> "Dune" wrote:
> > I'm trying to execute an aspx page by calling Server.Execute.
> > The aspx page I'm trying to execute is in a different web app from the
aspx page containing the Server.Execute statement. A slightly clearer
explanation...
> > Page1 exists in WebApp1. In the code-behind of Page2 in WebApp2, I have
put Server.Execute("Path to Page1 in WebApp1").
> > When I call Server.Execute(String) using
"http://localhost/WebApp1/Page1.aspx", everything works ok and Page1 pops up
in a new window.
> > But when I try to use the same path with the overloaded version,
Server.Execute(String, TextWriter), I get an error saying I must pass in a
virtual path. So I pass in "../WebApp1/Page1.aspx" as the path. But now I
get this error:
> > The virtual path '/WebApp1/Page1.aspx.cs' maps to another application,
which is not allowed.
> > But I can execute the same page using Server.Execute(String) and
"http://..."!!
> > So, is my virtual path wrong? Or is it something else?
> > (I need to use the overloaded version Server.Execute(String, TextWriter)
so that I can capture the output from Page1 and NOT have it popup in a new
window.)