Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 1st, 2009, 12:52 PM
Authorized User
 
Join Date: Jan 2004
Location: , , .
Posts: 30
Thanks: 1
Thanked 0 Times in 0 Posts
Default How to Change ASP.NET into Classic ASP?

I need to convert a asp.net page back into classic ASP and I am running into problems in getting this accomplished. It is blowing up all over the place.
Help needed now!
Thank you.

I have:

Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")

Dim cmd
Set cmd = Server.CreateObject("ADODB.Command")

objConn.Open ConnectionString
cmd.Connection = sqlcon
cmd.CommandText = "sp_setapprole"
cmd.CommandType = CommandType.StoredProcedure

Dim rolename As SqlClient.SqlParameter = cmd.Parameters.Add("@rolename", SqlDbType.VarChar, 20)
rolename.Value = "PW1"
Dim password As SqlClient.SqlParameter = cmd.Parameters.Add("@password", SqlDbType.VarChar, 20)
password.Value = "PW2"

cn.Open()

cmd.ExecuteNonQuery()
Dim strUser As String
strUser = "DOMAIN\Users"
If (Roles.IsUserInRole(strUser)) Then
txtEmpID.Focus()
Else
Response.Redirect("http://home.asp")
End If
  #2 (permalink)  
Old April 1st, 2009, 01:09 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

O.o Ok. Lots of problems here. First, for everything from your declaration of objRS to cmd.ExecuteNonQuery() go here about 3/4ths of the way down: http://www.15seconds.com/issue/000810.htm

Also you are referring to the same thing by 2 different names. You call objConn.Open then call cn.Open a little while later. Obviously only one of the objects refer to a connection and you only need ot open it once.

Second, since ASP is a weak typed language it has no support for string, int, double, etc during the declaration of the variable and, as such, all variables are defined as variants. So instead of Dim strUser as String you should only do Dim strUser.

ASP does not have a built-in membership/role provider so the call to Roles.IsUserInRole will need to be removed and you will have to write your own method to make this determination.

Lastly, you do not have access to TextBoxes like objects in classic asp. To set the focus of the textbox you are going to need to emit some javascript to achieve the desired result.

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
The Following User Says Thank You to dparsons For This Useful Post:
GailCG (April 1st, 2009)
  #3 (permalink)  
Old April 22nd, 2009, 06:04 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Well, that was a pretty irrelevant and useless post. Factually correct, but so what. Are you actually fishing for work??? That is, spamming us so you can get your URL in there?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Classic Asp to Asp.Net 2.0 vikaspatyal ASP.NET 2.0 Professional 2 October 7th, 2007 06:33 PM
asp.net vs classic asp "URGENT" naeem_ul_hussan Classic ASP Professional 1 August 1st, 2007 03:14 PM
classic asp with asp.net on same iis bostonrose .NET Framework 2.0 6 January 10th, 2007 12:38 PM
CLassic ASP in Visual Studio.NET rodmcleay ASP.NET 1.0 and 1.1 Professional 2 September 6th, 2004 08:06 PM
Best Practise for VS.NET IDE and Classic ASP rodmcleay Classic ASP Professional 1 September 3rd, 2004 03:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.