473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GET/POST in ASP.Net

Hi, for an assignment I have to write a function that can write to a
database and then also update the data.

I would like to use the same web form (page?) to write the data as the
one to update the data. All I want to have different is to display
some fields as protected and hide the password validation field.

So I thought if I create a simple html page with GET or POST data I
could retrieve the data in my LOAD event to decide which fields to
show or make read-only

The html page would look like this

<html>
<body>
<a HREF="Assignment6.aspx?fn=Register"Register as a new user</a>
<br>
<a HREF="Assignment6.aspx?fn=Update">Update member data</a>
</body>
</html>

I also know in Javascript I can retrieve the data by coding
fn = request("fn");

My question is if I can either
a) expose the javascript variable fn to my asp.net VB code or
b) is there a vb method to obtain that data?

I've been looking at the help and at web pages for a few hours now and
it seems so complicated that I can hardly believe I'm looking at the
right stuff.

Thanks.

Apr 10 '07 #1
4 12124
On Apr 10, 8:13 pm, "MikeB" <MPBr...@gmail.comwrote:
Hi, for an assignment I have to write a function that can write to a
database and then also update the data.

I would like to use the same web form (page?) to write the data as the
one to update the data. All I want to have different is to display
some fields as protected and hide the password validation field.

So I thought if I create a simple html page with GET or POST data I
could retrieve the data in my LOAD event to decide which fields to
show or make read-only

The html page would look like this

<html>
<body>
<a HREF="Assignment6.aspx?fn=Register"Register as a new user</a>
<br>
<a HREF="Assignment6.aspx?fn=Update">Update member data</a>
</body>
</html>

I also know in Javascript I can retrieve the data by coding
fn = request("fn");

My question is if I can either
a) expose the javascript variable fn to my asp.net VB code or
b) is there a vb method to obtain that data?

I've been looking at the help and at web pages for a few hours now and
it seems so complicated that I can hardly believe I'm looking at the
right stuff.

Thanks.
You need the Request.QueryString

If Request.QueryString("fn") = "Register" then
.....
else if Request.QueryString("fn") = "Update" then
.....
End If

Apr 10 '07 #2
On Apr 10, 1:20 pm, "Alexey Smirnov" <alexey.smir...@gmail.comwrote:
On Apr 10, 8:13 pm, "MikeB" <MPBr...@gmail.comwrote:
Hi, for an assignment I have to write a function that can write to a
database and then also update the data.
I would like to use the same web form (page?) to write the data as the
one to update the data. All I want to have different is to display
some fields as protected and hide the password validation field.
So I thought if I create a simple html page with GET or POST data I
could retrieve the data in my LOAD event to decide which fields to
show or make read-only
The html page would look like this
<html>
<body>
<a HREF="Assignment6.aspx?fn=Register"Register as a new user</a>
<br>
<a HREF="Assignment6.aspx?fn=Update">Update member data</a>
</body>
</html>
I also know in Javascript I can retrieve the data by coding
fn = request("fn");
My question is if I can either
a) expose the javascript variable fn to my asp.net VB code or
b) is there a vb method to obtain that data?
I've been looking at the help and at web pages for a few hours now and
it seems so complicated that I can hardly believe I'm looking at the
right stuff.
Thanks.

You need the Request.QueryString

If Request.QueryString("fn") = "Register" then
....
else if Request.QueryString("fn") = "Update" then
....
End If
Thanks!

Apr 10 '07 #3
You need the Request.QueryString
>
If Request.QueryString("fn") = "Register" then
....
else if Request.QueryString("fn") = "Update" then
....
End If
But doesnt' that defeat the purpose of using ASP.net to begin with?

Normally, you do this via the postback. Which handles most of this for you.

So, you may have a textbox:

asp:textbox id="myTextBox"

and then to grab the value on the postback, all you need to do is:

myValue = myTextBox.text

-Darrel
Apr 10 '07 #4

The way you are doing it is very non asp.net 'ish.

Start here:
http://asp101.com/samples/db_add_aspx.asp

Asp.Net is there to make your life easier.

You're kinda going backwards with your approach.

"MikeB" <MP*****@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
Hi, for an assignment I have to write a function that can write to a
database and then also update the data.

I would like to use the same web form (page?) to write the data as the
one to update the data. All I want to have different is to display
some fields as protected and hide the password validation field.

So I thought if I create a simple html page with GET or POST data I
could retrieve the data in my LOAD event to decide which fields to
show or make read-only

The html page would look like this

<html>
<body>
<a HREF="Assignment6.aspx?fn=Register"Register as a new user</a>
<br>
<a HREF="Assignment6.aspx?fn=Update">Update member data</a>
</body>
</html>

I also know in Javascript I can retrieve the data by coding
fn = request("fn");

My question is if I can either
a) expose the javascript variable fn to my asp.net VB code or
b) is there a vb method to obtain that data?

I've been looking at the help and at web pages for a few hours now and
it seems so complicated that I can hardly believe I'm looking at the
right stuff.

Thanks.

Apr 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
1
by: khawar | last post by:
my application is in asp.net using C# hi guys having a complicated problem i am using payflowlink to process CC payments I have to send a httppost to their servers. The problem is how do i do a...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
1
by: Manuel | last post by:
I have to log into a website and retrieve some information. The problem is that the post isn't "normal". I'm used to passing post values in the form of: Variable1=Value1&Variable2=Value2 etc. I...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
24
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button...
9
by: c676228 | last post by:
Hi, I am new to this discussion forum. I started to post questions on this forum since this Jan. and got many good responses and I am very appreciated to those who are willing to help with their...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
10
by: Peter Michaux | last post by:
Hi, All Ajax libraries I've read use encodeURIComponent() on the name- value pairs extracted from forms before POST ing the result to the server with and xmlhttprequest. I can understand why...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.