473,790 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Alp haNumOnly(Reque st.QueryString( "un"))
Dim MyPw As String = MyFunctions.Alp haNumOnly(Reque st.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 1861
to make it clear, here is my class

--------------
Public Class MyFunctions
Public Shared Function CheckLogin(ByVa l 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(MyPw Input) & "'"
Dim Conn As New OleDbConnection (MyDbPath)
Dim Cmd As New OleDbCommand(My Sql, Conn)
Conn.Open()
MyResult = Cmd.ExecuteScal ar
Conn.Close()
Return MyResult
End Function
End Class
----------------------
how can i write so, instead of MyUnInput,MyPwI nput i can call
request.queryst ring("un"),requ est.querystring ("pw")

".nLL" <no***@here.com wrote in message
news:UT******** *********@newsf e01.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.Alp haNumOnly(Reque st.QueryString( "un"))
Dim MyPw As String =
MyFunctions.Alp haNumOnly(Reque st.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_Aut horizeRequest(o bject 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(ByVa l 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(MyPw Input) & "'"
Dim Conn As New OleDbConnection (MyDbPath)
Dim Cmd As New OleDbCommand(My Sql, Conn)
Conn.Open()
MyResult = Cmd.ExecuteScal ar
Conn.Close()
Return MyResult
End Function
End Class
----------------------
how can i write so, instead of MyUnInput,MyPwI nput i can call
request.queryst ring("un"),requ est.querystring ("pw")

".nLL" <no***@here.com wrote in message
news:UT******** *********@newsf e01.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.Al phaNumOnly(Requ est.QueryString ("un"))
Dim MyPw As String =
MyFunctions.Al phaNumOnly(Requ est.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******** ******@TK2MSFTN GP02.phx.gbl...
create a global.asa and add:

void Application_Aut horizeRequest(o bject 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(ByVa l 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(MyPw Input) & "'"
Dim Conn As New OleDbConnection (MyDbPath)
Dim Cmd As New OleDbCommand(My Sql, Conn)
Conn.Open()
MyResult = Cmd.ExecuteScal ar
Conn.Close()
Return MyResult
End Function
End Class
----------------------
how can i write so, instead of MyUnInput,MyPwI nput i can call
request.querys tring("un"),req uest.querystrin g("pw")

".nLL" <no***@here.com wrote in message
news:UT******* **********@news fe01.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.A lphaNumOnly(Req uest.QueryStrin g("un"))
Dim MyPw As String =
MyFunctions.A lphaNumOnly(Req uest.QueryStrin g("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(MyPw Input) & "'"

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
4758
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 like this: %@ Language=VBScript %> <!--#include file="includes/openconnection.asp"-->
9
1655
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") response.write("<TABLE ALIGN=CENTER>")
17
2649
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 directly. so I need a way doing this. so I check to see if the ifp value is null and if so then assign it a value. is this correct?
9
6030
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 index and get the key then the item out of the query string...
7
1440
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
1577
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"; data.load(dataUrl) ; var transform = new ActiveXObject("Microsoft.XMLDOM"); transform.async = false ;
7
1871
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 submit button, but when I'm getting the form collection (using post or get (form/querystring) I can't retrieve that
7
3948
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, correctly. However, when I click on a menu item in that page, it then executes the same page load twice, before transferring control (via a response.redirect) to the new page. On the first pass through the page load of the menu page, the session...
0
1339
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 channel in the lower right, and the single item in the top right based on a selection in the lower right. When the channel within the left frame is clicked, bottom right frame changes with the items for the channel (feed). Taking it step-by-step. Have...
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.