Connecting Tech Pros Worldwide Forums | Help | Site Map

Dynamically create and call a function

MRW
Guest
 
Posts: n/a
#1: Aug 6 '06
Hello!

I'm trying to do something very simple. On the bottom of my page, I
want to dynamically create and display something like (in hyperlink
text):

Home | Page 1

and if x = 1 (for example), I want it do display:

Home | Page 1 | Page 2

So, when they click "Page 2", it will run a VB function on the server.

Using javascript, I could easily use Response.write <a href..., however
I want to call the function on the server.

Thanks for any help!


Peter Bromberg [C# MVP]
Guest
 
Posts: n/a
#2: Aug 6 '06

re: Dynamically create and call a function


An easy way to do this would be to simply put ?func=1 on the querystring, and
intercept that in your Page_Load, e.g., (C# here)

if(Request.Querystring["func"]=="1")
MyMethod( Request.QueryString["func"]);

You should also check for querstring being null above this.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"MRW" wrote:
Quote:
Hello!
>
I'm trying to do something very simple. On the bottom of my page, I
want to dynamically create and display something like (in hyperlink
text):
>
Home | Page 1
>
and if x = 1 (for example), I want it do display:
>
Home | Page 1 | Page 2
>
So, when they click "Page 2", it will run a VB function on the server.
>
Using javascript, I could easily use Response.write <a href..., however
I want to call the function on the server.
>
Thanks for any help!
>
>
MRW
Guest
 
Posts: n/a
#3: Aug 6 '06

re: Dynamically create and call a function


Something so simple, yet works so well! Thanks very much for the help!

Peter wrote:
Quote:
An easy way to do this would be to simply put ?func=1 on the querystring, and
intercept that in your Page_Load, e.g., (C# here)
>
if(Request.Querystring["func"]=="1")
MyMethod( Request.QueryString["func"]);
>
You should also check for querstring being null above this.
Peter
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"MRW" wrote:
>
Quote:
Hello!

I'm trying to do something very simple. On the bottom of my page, I
want to dynamically create and display something like (in hyperlink
text):

Home | Page 1

and if x = 1 (for example), I want it do display:

Home | Page 1 | Page 2

So, when they click "Page 2", it will run a VB function on the server.

Using javascript, I could easily use Response.write <a href..., however
I want to call the function on the server.

Thanks for any help!
Mark Rae
Guest
 
Posts: n/a
#4: Aug 6 '06

re: Dynamically create and call a function


"Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.comwrote in message
news:FBAAA33C-7554-46B7-9A13-E0CBA4565075@microsoft.com...
Quote:
You should also check for querstring being null above this.
And also for users changing the QueryString manually...


MRW
Guest
 
Posts: n/a
#5: Aug 6 '06

re: Dynamically create and call a function


Mmmm... is there a way to bypass that problem? Not that it's the
biggest problem in the world...

Mark Rae wrote:
Quote:
"Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.comwrote in message
news:FBAAA33C-7554-46B7-9A13-E0CBA4565075@microsoft.com...
>
Quote:
You should also check for querstring being null above this.
>
And also for users changing the QueryString manually...
Mark Rae
Guest
 
Posts: n/a
#6: Aug 6 '06

re: Dynamically create and call a function


"MRW" <mwinne1@yahoo.comwrote in message
news:1154893277.126671.270750@i42g2000cwa.googlegr oups.com...
Quote:
Mmmm... is there a way to bypass that problem?
Not while using QueryStrings...

I never ever use QueryStrings unless there's absolutely no other option for
this precise reason and, if I have to use them, I encrypt them...



Peter Bromberg [C# MVP]
Guest
 
Posts: n/a
#7: Aug 6 '06

re: Dynamically create and call a function


Personally, I think this is an issue that is heavily "overblown" by the
so-called security pundits. Sure, if somebody manipulatiing your querystring
is going to
cause financial or other security breaches, of course it's an issue. But in
many
cases it is used for nothing more than simple navigation or in your case for
deciding whether to call a method that displays some control or not.

You can still use the querystring and obfuscate it quite nicely. Here is an
article
I did on a technique for this. You can see how I got flamed for it by people
with nasty agendas who either cannot read, or never even got past the third
paragraph:

http://www.eggheadcafe.com/articles/20060427.asp

Peter


--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"MRW" wrote:
Quote:
Mmmm... is there a way to bypass that problem? Not that it's the
biggest problem in the world...
>
Mark Rae wrote:
Quote:
"Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.comwrote in message
news:FBAAA33C-7554-46B7-9A13-E0CBA4565075@microsoft.com...
Quote:
You should also check for querstring being null above this.
And also for users changing the QueryString manually...
>
>
Mark Rae
Guest
 
Posts: n/a
#8: Aug 6 '06

re: Dynamically create and call a function


"Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.comwrote in message
news:E6F374AD-F024-4F04-8B31-4B7DAA25119D@microsoft.com...
Quote:
You can still use the querystring and obfuscate it quite nicely. Here is
an
article I did on a technique for this. You can see how I got flamed for it
by people
with nasty agendas who either cannot read, or never even got past the
third
paragraph:
>
http://www.eggheadcafe.com/articles/20060427.asp
Actually, it's a pretty good article. If you absolutely *have* to use
QueryStrings, encryption / obfuscation like this is really the only sensible
way to do it...


Closed Thread