![]() |
|
|
|||||||
![]() |
ASP Net - Dynamically create and call a function |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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=?= |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
"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 |
|
|
|
#5 |
|
Posts: n/a
|
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 |
|
|
|
#6 |
|
Posts: n/a
|
"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 |
|
|
|
#7 |
|
Posts: n/a
|
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=?= |
|
|
|
#8 |
|
Posts: n/a
|
"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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |