473,320 Members | 1,841 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,320 software developers and data experts.

newbie/noob question. request querystring in a .vb

Hi, im am a classic asp developer and started to learn asp.net but got stuck
with a simple problem even before i step in to further.

to learn i have started from a simple project (a login system with forms)
due to projects platform (a mobile web site) i cant use cookies (cookies
arent supported on all phones), anyway because of that i do un/pw check on
very page and i have to put

Dim MyUn As String = MyFunctions.AlphaNumOnly(Request.QueryString("un") )
Dim MyPw As String = MyFunctions.AlphaNumOnly(Request.QueryString("pw") )

to every page. In classic asp i could create an include and put smilar code
to get un/pw but in asp.net (VB) i couldnt figureout how to. I ahve got my
functions.vb where i store shared functions and variables but could put
above in to it.
could anyone point me to right direction?
thanks

Oct 5 '08 #1
4 1831
to make it clear, here is my class

--------------
Public Class MyFunctions
Public Shared Function CheckLogin(ByVal MyUnInput As String, ByVal
MyPwInput As String) As String
Dim MyResult As Integer
Dim MySql As String
MySql = "Select count(*) from users where un='" & MyUnInput & "' and
pw='" & MD5Encrypt(MyPwInput) & "'"
Dim Conn As New OleDbConnection(MyDbPath)
Dim Cmd As New OleDbCommand(MySql, Conn)
Conn.Open()
MyResult = Cmd.ExecuteScalar
Conn.Close()
Return MyResult
End Function
End Class
----------------------
how can i write so, instead of MyUnInput,MyPwInput i can call
request.querystring("un"),request.querystring("pw" )

".nLL" <no***@here.comwrote in message
news:UT*****************@newsfe01.ams2...
Hi, im am a classic asp developer and started to learn asp.net but got
stuck with a simple problem even before i step in to further.

to learn i have started from a simple project (a login system with forms)
due to projects platform (a mobile web site) i cant use cookies (cookies
arent supported on all phones), anyway because of that i do un/pw check on
very page and i have to put

Dim MyUn As String =
MyFunctions.AlphaNumOnly(Request.QueryString("un") )
Dim MyPw As String =
MyFunctions.AlphaNumOnly(Request.QueryString("pw") )

to every page. In classic asp i could create an include and put smilar
code to get un/pw but in asp.net (VB) i couldnt figureout how to. I ahve
got my functions.vb where i store shared functions and variables but could
put above in to it.
could anyone point me to right direction?
thanks
Oct 5 '08 #2
create a global.asa and add:

void Application_AuthorizeRequest(object sender, EventArgs e)
{
// call by validation code here
}
note: while shared functions are ok, shared variables (or public module
variables) are shared across all requests.

-- bruce (sqlwork.com)

..nLL wrote:
to make it clear, here is my class

--------------
Public Class MyFunctions
Public Shared Function CheckLogin(ByVal MyUnInput As String, ByVal
MyPwInput As String) As String
Dim MyResult As Integer
Dim MySql As String
MySql = "Select count(*) from users where un='" & MyUnInput & "'
and pw='" & MD5Encrypt(MyPwInput) & "'"
Dim Conn As New OleDbConnection(MyDbPath)
Dim Cmd As New OleDbCommand(MySql, Conn)
Conn.Open()
MyResult = Cmd.ExecuteScalar
Conn.Close()
Return MyResult
End Function
End Class
----------------------
how can i write so, instead of MyUnInput,MyPwInput i can call
request.querystring("un"),request.querystring("pw" )

".nLL" <no***@here.comwrote in message
news:UT*****************@newsfe01.ams2...
>Hi, im am a classic asp developer and started to learn asp.net but got
stuck with a simple problem even before i step in to further.

to learn i have started from a simple project (a login system with
forms) due to projects platform (a mobile web site) i cant use cookies
(cookies arent supported on all phones), anyway because of that i do
un/pw check on very page and i have to put

Dim MyUn As String =
MyFunctions.AlphaNumOnly(Request.QueryString("un" ))
Dim MyPw As String =
MyFunctions.AlphaNumOnly(Request.QueryString("pw" ))

to every page. In classic asp i could create an include and put smilar
code to get un/pw but in asp.net (VB) i couldnt figureout how to. I
ahve got my functions.vb where i store shared functions and variables
but could put above in to it.
could anyone point me to right direction?
thanks
Oct 5 '08 #3
old habits die hard, isn't there any other option to do it? i dont want to
use global.asa or web.config. reason is that i want to be able to put
project in any folder on my server without having setup an appliaciton on
iis for it. that way it is portable and can be moved without any setup on
web server

"bruce barker" <no****@nospam.comwrote in message
news:up**************@TK2MSFTNGP02.phx.gbl...
create a global.asa and add:

void Application_AuthorizeRequest(object sender, EventArgs e)
{
// call by validation code here
}
note: while shared functions are ok, shared variables (or public module
variables) are shared across all requests.

-- bruce (sqlwork.com)

.nLL wrote:
>to make it clear, here is my class

--------------
Public Class MyFunctions
Public Shared Function CheckLogin(ByVal MyUnInput As String, ByVal
MyPwInput As String) As String
Dim MyResult As Integer
Dim MySql As String
MySql = "Select count(*) from users where un='" & MyUnInput & "'
and pw='" & MD5Encrypt(MyPwInput) & "'"
Dim Conn As New OleDbConnection(MyDbPath)
Dim Cmd As New OleDbCommand(MySql, Conn)
Conn.Open()
MyResult = Cmd.ExecuteScalar
Conn.Close()
Return MyResult
End Function
End Class
----------------------
how can i write so, instead of MyUnInput,MyPwInput i can call
request.querystring("un"),request.querystring("pw ")

".nLL" <no***@here.comwrote in message
news:UT*****************@newsfe01.ams2...
>>Hi, im am a classic asp developer and started to learn asp.net but got
stuck with a simple problem even before i step in to further.

to learn i have started from a simple project (a login system with
forms) due to projects platform (a mobile web site) i cant use cookies
(cookies arent supported on all phones), anyway because of that i do
un/pw check on very page and i have to put

Dim MyUn As String =
MyFunctions.AlphaNumOnly(Request.QueryString("un "))
Dim MyPw As String =
MyFunctions.AlphaNumOnly(Request.QueryString("pw "))

to every page. In classic asp i could create an include and put smilar
code to get un/pw but in asp.net (VB) i couldnt figureout how to. I ahve
got my functions.vb where i store shared functions and variables but
could put above in to it.
could anyone point me to right direction?
thanks
Oct 5 '08 #4
one thing:
this is not the right way:
MySql = "Select count(*) from users where un='" & MyUnInput & "' and
pw='" & MD5Encrypt(MyPwInput) & "'"

use parameters! this way up here you will have trouble with
sqlinjection.
>that way it is portable and can be moved without any setup on web server
I am curious the way you are developing...
in my idea: just put global.asax and web.config in the root folder of
the website using the asp.net page, and is done, what else?
I mean web.config is required.

Simone Foschi
MCTS Sql Server 2005
Oct 8 '08 #5

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

Similar topics

13
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is...
9
by: SASRS | last post by:
Here is my code. I am trying to see if I can put a %@ LANGUAGE="VBSCRIPT" %> <% FieldA = Request.QueryString("A") FieldB = Request.QueryString("B") FieldC = Request.QueryString("C") ...
17
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in...
9
by: Doug | last post by:
I need to do the following... FOR myitem IN Request.Querystring 'get the key 'get the value NEXT What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by...
7
by: Stan Sainte-Rose | last post by:
Hi, I use this bit of code to generate dynamic tables in the page load section .... Dim ntable as New Table For i = 1993 To 2008 ntable = New Table ntable.ID = "Q" + i.ToString .... ....
6
by: Steve B. | last post by:
Hello everybody In a webpage, I use JS display data from an xml file and a xsl file: var data = new ActiveXObject("Microsoft.XMLDOM"); data.async = false; var dataUrl = "data.aspx";...
7
by: Bruno Alexandre | last post by:
Hi guys, Sorry about the off topic, but I can't find the ASP group just the ASP dot NET If I want to block a user to change a form after submiting, I add a function that will disable the...
7
by: Goober | last post by:
I have a page that receives a session variable from the default.aspx. On Page load, the code in Page load gets executed twice. So far, no problem. It sets the session variable each time,...
0
by: janetb | last post by:
Brand new to xml and I'm trying to get Scott Mitchell's rss aggregator example working locally. Basically, involves a frameset with the channels(feeds) in the left frame, a list of items in the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.