Showing posts with label calling. Show all posts
Showing posts with label calling. Show all posts

Saturday, March 31, 2012

Server side function calling

Hi,
Uses: VS.NET 2003, VB.NET, Windows xp

I've written an apsx web page through vb.net. In that I've mentioned a
procedure(Server Side). Now I want to call it through Jscript.

The reason behind is about validations. There are some text to enter in one
text box. So once the user has entered the text, it will check whether the
text is null, if not it will call that server side procedure I've mentioned
in aspx page.

I'm wondering how can I call it. One guy in the news group said to use the
following:

1. __doPostBack(...);
2. document.forms[0].submit();
3. document.getElementById(<Some asp control's client ID>).click();

however it wasn't specific and I didn't understod how to use it. Using codes
to illustrate the solution will be much worthy here.

Thank you,
--
Mohammed Hifni Shahzard Nazeer,
JB Securities Pvt. Ltd.,
Colombo.Hifni Shahzard wrote:
> Hi,
> Uses: VS.NET 2003, VB.NET, Windows xp
> I've written an apsx web page through vb.net. In that I've mentioned a
> procedure(Server Side). Now I want to call it through Jscript.
> The reason behind is about validations. There are some text to enter
> in one text box. So once the user has entered the text, it will check
> whether the text is null, if not it will call that server side
> procedure I've mentioned in aspx page.
> I'm wondering how can I call it. One guy in the news group said to
> use the following:
> 1. __doPostBack(...);
> 2. document.forms[0].submit();
> 3. document.getElementById(<Some asp control's client ID>).click();
> however it wasn't specific and I didn't understod how to use it.
> Using codes to illustrate the solution will be much worthy here.
> Thank you,

If you want validation, use a CustomValidator. You could provide some
client-side javascript, but that's not required. You are after the server-side
event. There you can do your validation.

Hans Kesting
You can use the AJAX.NET libraries to asynchronously do a server side method
call easily through javascript.

Go here http://ajax.schwarz-interactive.de/...le/default.aspx for
examples and downloadable libraries and code.

--
- Paul Glavich
MVP ASP.NET
http://weblogs.asp.net/pglavich
ASPInsiders member - http://www.aspinsiders.com

"Hans Kesting" <news.2.hansdk@.spamgourmet.com> wrote in message
news:%23VZF4l%23zFHA.1968@.TK2MSFTNGP10.phx.gbl...
> Hifni Shahzard wrote:
>> Hi,
>> Uses: VS.NET 2003, VB.NET, Windows xp
>>
>> I've written an apsx web page through vb.net. In that I've mentioned a
>> procedure(Server Side). Now I want to call it through Jscript.
>>
>> The reason behind is about validations. There are some text to enter
>> in one text box. So once the user has entered the text, it will check
>> whether the text is null, if not it will call that server side
>> procedure I've mentioned in aspx page.
>>
>> I'm wondering how can I call it. One guy in the news group said to
>> use the following:
>>
>> 1. __doPostBack(...);
>> 2. document.forms[0].submit();
>> 3. document.getElementById(<Some asp control's client ID>).click();
>>
>> however it wasn't specific and I didn't understod how to use it.
>> Using codes to illustrate the solution will be much worthy here.
>>
>> Thank you,
> If you want validation, use a CustomValidator. You could provide some
> client-side javascript, but that's not required. You are after the
> server-side
> event. There you can do your validation.
> Hans Kesting

Server side function calling

Hi,
Uses: VS.NET 2003, VB.NET, Windows xp
I've written an apsx web page through vb.net. In that I've mentioned a
procedure(Server Side). Now I want to call it through Jscript.
The reason behind is about validations. There are some text to enter in one
text box. So once the user has entered the text, it will check whether the
text is null, if not it will call that server side procedure I've mentioned
in aspx page.
I'm wondering how can I call it. One guy in the news group said to use the
following:
1. __doPostBack(...);
2. document.forms[0].submit();
3. document.getElementById(<Some asp control's client ID> ).click();
however it wasn't specific and I didn't understod how to use it. Using codes
to illustrate the solution will be much worthy here.
Thank you,
--
Mohammed Hifni Shahzard Nazeer,
JB Securities Pvt. Ltd.,
Colombo.Hifni Shahzard wrote:
> Hi,
> Uses: VS.NET 2003, VB.NET, Windows xp
> I've written an apsx web page through vb.net. In that I've mentioned a
> procedure(Server Side). Now I want to call it through Jscript.
> The reason behind is about validations. There are some text to enter
> in one text box. So once the user has entered the text, it will check
> whether the text is null, if not it will call that server side
> procedure I've mentioned in aspx page.
> I'm wondering how can I call it. One guy in the news group said to
> use the following:
> 1. __doPostBack(...);
> 2. document.forms[0].submit();
> 3. document.getElementById(<Some asp control's client ID> ).click();
> however it wasn't specific and I didn't understod how to use it.
> Using codes to illustrate the solution will be much worthy here.
> Thank you,
If you want validation, use a CustomValidator. You could provide some
client-side javascript, but that's not required. You are after the server-si
de
event. There you can do your validation.
Hans Kesting
You can use the AJAX.NET libraries to asynchronously do a server side method
call easily through javascript.
Go here http://ajax.schwarz-interactive.de/...le/default.aspx for
examples and downloadable libraries and code.
- Paul Glavich
MVP ASP.NET
http://weblogs.asp.net/pglavich
ASPInsiders member - http://www.aspinsiders.com
"Hans Kesting" <news.2.hansdk@.spamgourmet.com> wrote in message
news:%23VZF4l%23zFHA.1968@.TK2MSFTNGP10.phx.gbl...
> Hifni Shahzard wrote:
> If you want validation, use a CustomValidator. You could provide some
> client-side javascript, but that's not required. You are after the
> server-side
> event. There you can do your validation.
> Hans Kesting
>

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

Thursday, March 22, 2012

Server.execute fired twice

I am trying to calling sendmail.aspx page from a submitjob.aspx page to send email using server.execute ("sendmail.aspx?jobID=4"). The mail was send, however, it send twice. There got be a simple fix for this problem. Any helps are appreciated.

Thanks

-Ron

Well this is not enough to decide. Maybe there is something in yourcode that is calling submitjob.aspx twice. Can we have a look at thecode-behind you have ?
regards