Dynamically create and call a function

M

MRW

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!
 
G

Guest

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
 
M

MRW

Something so simple, yet works so well! Thanks very much for the help!
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 said:
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!
 
M

MRW

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

Mark Rae

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

Guest

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
 
M

Mark Rae

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top