Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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
 
Old October 24th, 2003, 01:03 PM
Authorized User
 
Join Date: Oct 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mixing Scripting Languages

I'm developing an intranet site using Dreamweaver MX in a mixed ASP/ASP.NET environment (don't ask me why, probably becuase I want to learn .net) Dreamweaver MX doesn't have a 'restrict access to page' server behavior for .NET, so I am trying to use the VBScript code to perform the same function. First, is it possible to use old school VBScript in a .NET page? Second, this code:

dim MM_authorizedUsers, MM_authFailedURL, MM_grantAccess, MM_qsChar as string
dim MM_referrer
MM_authorizedUsers=""

returns an error that MM_authorizedUsers must be declared. I assume that will happen with all the variables (uh, yea, it's Dreamweaver generated code, I'm doing this on the fly)

Thanks,

Steve

 
Old October 24th, 2003, 01:34 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

This is going to be complicated. It is possible to convert the Dreamweaver authentication code to ASP.NET. You'll need to do some strong typing (like: Dim MM_authorizedUsers As String = ""), enable sessions on your server and it may more or less work.

However, IMO, it's not going to be pretty. You can't really share Session state between the two technologies. Since the DW code uses Session for authentication purposes, you'll need to use ASP Sessions and ASP.NET Sessions to store the authentication information. This will most likely require your user to log on twice: once for each technology.

If they do have to logon twice, a) your users are not going to be happy and b) you might as well user ASP.NET authentication. ASP.NET authentication is relatively easy to set up and use, and pretty flexible.

I had the same issue in a corporate Intranet I designed and build for a customer. It was along running project, and while we were building it, ASP.NET came around which offered a lot of stuff we needed so we ended up with a dual-technology project.

If I had to do it all over again, I would port the old ASP code to ASP.NET and just use that for the entire site.

That said, it is possible to do what you want.

Here're the basic steps you need to perform:

1. Convert the ASP code to ASP.NET and make sure it works

2. In your old Login page, find a way to send data to the ASPX session object. You could for example use a self-submitting form that sends the username and roles from the ASP to the ASPX page. In the ASPX page, you'll need to save the required info like username and roles / (Access Levels to be exact) in the ASP.NET Session state.
Alternatively, you can store the logon information in an encrypted cookie, and decrypt it again in the ASPX page (that's how we did it).

3. Include a User Control on each protected page that does the validation. Check the Session variables (like the Dreamweaver code does) and redirect away when the user has not been authenticated properly.

If you have the possibility, convert the entire ASP project to .NET (I heard there is a converter available from Microsoft, but I don't really trust / believe in this kind of things).
On a single platform, things will be much easier down the road; you'll find that you'll often have to invent the wheel twice for each new feature you're going to add to your site.

Good luck, and if you have any specific conversion questions (or other questions), post them here.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 24th, 2003, 06:12 PM
Authorized User
 
Join Date: Oct 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

Thank you for your input, it was very helpful. I am not committed to staying with ASP, in fact, I would prefer everything to be in .NET. Since I am a newbie, I am (early on) bound to using Dreamweavers pre-written server behaviors. Since a page restriction/user logon existed for ASP but not ASP.NET, I used it thinking I could rework the code later. If it is easier to build a page authentication in .NET, and use the session variable for all my aspx pages, I'll do that...I'm not married to ASP at all. My next question would be, if you or someone could direct me to a site that would help build that authentication out.

Thanks again,

Steve

 
Old October 26th, 2003, 01:52 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Steve,

If you search the Web for "forms authentication" and ASP.NET you'll find plenty of examples. For example:

http://www.4guysfromrolla.com/webtech/110701-1.shtml

There are lots of other sites, tutorials etc. available.

Cheers,


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 27th, 2003, 02:05 PM
Authorized User
 
Join Date: Oct 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, that is exactly the kind of article I was looking for.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Mixing C and C# in a project? rotgut C# 2005 7 March 26th, 2007 07:05 AM
SCRIPTING LANGUAGES itsmepiyush_kool Intro Programming 2 December 13th, 2006 03:50 PM
Mixing PHP and Javascript nmjnmj Pro PHP 4 December 9th, 2006 01:31 AM
Session Id mixing jejedp VS.NET 2002/2003 0 January 4th, 2006 07:54 PM
mixing results of checkboxes Hatchingabrain Javascript 2 April 4th, 2005 04:02 AM





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