Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Dynamically create and call a function

 
Thread Tools Search this Thread
Old 08-06-2006, 05:01 PM   #1
Default Dynamically create and call a function


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
  Reply With Quote
Old 08-06-2006, 07:29 PM   #2
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
 
Posts: n/a
Default 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:

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



=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
  Reply With Quote
Old 08-06-2006, 07:57 PM   #3
MRW
 
Posts: n/a
Default Re: Dynamically create and call a function
Something so simple, yet works so well! Thanks very much for the help!

Peter wrote:
> 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:
>
> > 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
  Reply With Quote
Old 08-06-2006, 08:15 PM   #4
Mark Rae
 
Posts: n/a
Default Re: Dynamically create and call a function
"Peter Bromberg [C# MVP]" <> wrote in message
news:FBAAA33C-7554-46B7-9A13-...

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


And also for users changing the QueryString manually...




Mark Rae
  Reply With Quote
Old 08-06-2006, 08:41 PM   #5
MRW
 
Posts: n/a
Default 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:
> "Peter Bromberg [C# MVP]" <> wrote in message
> news:FBAAA33C-7554-46B7-9A13-...
>
> > You should also check for querstring being null above this.

>
> And also for users changing the QueryString manually...




MRW
  Reply With Quote
Old 08-06-2006, 09:34 PM   #6
Mark Rae
 
Posts: n/a
Default Re: Dynamically create and call a function
"MRW" <> wrote in message
news: oups.com...

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





Mark Rae
  Reply With Quote
Old 08-06-2006, 09:46 PM   #7
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
 
Posts: n/a
Default 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:

> Mmmm... is there a way to bypass that problem? Not that it's the
> biggest problem in the world...
>
> Mark Rae wrote:
> > "Peter Bromberg [C# MVP]" <> wrote in message
> > news:FBAAA33C-7554-46B7-9A13-...
> >
> > > You should also check for querstring being null above this.

> >
> > And also for users changing the QueryString manually...

>
>



=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
  Reply With Quote
Old 08-06-2006, 11:58 PM   #8
Mark Rae
 
Posts: n/a
Default Re: Dynamically create and call a function
"Peter Bromberg [C# MVP]" <> wrote in message
news:E6F374AD-F024-4F04-8B31-...

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




Mark Rae
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Manager 6 CDR CSV file level_3rd General Help Related Topics 0 06-12-2008 09:16 AM
Cisco Call Manager 6 CSV Format level_3rd General Help Related Topics 0 06-12-2008 09:14 AM
Dynamically added TreeNode Control not render my custom attribute venkyzealous Software 0 05-10-2008 03:46 PM
Re: High Gasoline Prices Create A+ Service Opportunities Frederic A+ Certification 3 01-17-2004 11:38 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46