HighTechTalks DotNet Forums  

How to #include with .net

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss How to #include with .net in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
bnhcomputing
 
Posts: n/a

Default How to #include with .net - 10-20-2005 , 03:20 PM






I have the following at the top of my page
------------------------------------------------------------
<script runat = "server" >
Function Login_Action(ByVal UserName As String, ByVal Password As
String) As Boolean
' Insert code that implements a site-specific custom
' authentication method here.
'
' This example implementation always returns false.
Return False
End Function

Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs)
e.Authenticated = Login_Action(Login1.UserName, Login1.Password)
End Sub
</script>
-------------------------------------
This works as expected. What I would like to do is something like:
-------------------------------------

<script runat = "server" >

#include "lgnfile.vbs"

Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs)
e.Authenticated = Login_Action(Login1.UserName, Login1.Password)
End Sub
</script>
---------------------------------

And put the Login_Action funtion into the included file.

Any ideas if this is possible? How to do it? Every method I have tried
fails.

Thanks

--
bnhcomputing

Reply With Quote
  #2  
Old   
Bill Burwell
 
Posts: n/a

Default Re: How to #include with .net - 10-20-2005 , 05:57 PM






Check out these methods for .Net code behind or for VBScript
- RegisterStartupScript
- RegisterClientScriptBlock

"bnhcomputing" <bnhcomputing (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have the following at the top of my page
------------------------------------------------------------
script runat = "server"
Function Login_Action(ByVal UserName As String, ByVal Password As
String) As Boolean
' Insert code that implements a site-specific custom
' authentication method here.
'
' This example implementation always returns false.
Return False
End Function

Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs)
e.Authenticated = Login_Action(Login1.UserName, Login1.Password)
End Sub
/script
-------------------------------------
This works as expected. What I would like to do is something like:
-------------------------------------

script runat = "server"

#include "lgnfile.vbs"

Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs)
e.Authenticated = Login_Action(Login1.UserName, Login1.Password)
End Sub
/script
---------------------------------

And put the Login_Action funtion into the included file.

Any ideas if this is possible? How to do it? Every method I have tried
fails.

Thanks

--
bnhcomputing



Reply With Quote
  #3  
Old   
bnhcomputing
 
Posts: n/a

Default Re: How to #include with .net - 10-21-2005 , 09:37 AM



OK, I must be stupid.

I looked at those to methods, and they went in one ear, and out the other.

I was hoping there was some simple solution where I could just do an
#include statement like in ASP. That way, if my client finds a bug in the
site(s), I change the include file, they refresh, error fixed. I know I can
build DLL(s), but I really want to avoid that, because then I'd have to shut
the entire site down to do a repair.

When I use the old ASP way, I can specify includes at the top of the page
code as server script and then access those functions. Both of the methods
suggested are client side, not server side like the old ASP. Did we loose
functionality with .net (ASPX) ?

--
bnhcomputing


Reply With Quote
  #4  
Old   
Robbe Morris [C# MVP]
 
Posts: n/a

Default Re: How to #include with .net - 10-23-2005 , 09:06 AM



The same include syntax still works in ASP.NET.
I opted to use it when converted a 5 page ASP
site to ASP.NET in 2001 rather spend
a bunch of time rearchitecting the site.

But, it is considered bad practice. You really
should use UserControls instead.


--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net





"bnhcomputing" <bnhcomputing (AT) discussions (DOT) microsoft.com> wrote

Quote:
OK, I must be stupid.

I looked at those to methods, and they went in one ear, and out the other.

I was hoping there was some simple solution where I could just do an
#include statement like in ASP. That way, if my client finds a bug in the
site(s), I change the include file, they refresh, error fixed. I know I
can
build DLL(s), but I really want to avoid that, because then I'd have to
shut
the entire site down to do a repair.

When I use the old ASP way, I can specify includes at the top of the page
code as server script and then access those functions. Both of the
methods
suggested are client side, not server side like the old ASP. Did we loose
functionality with .net (ASPX) ?

--
bnhcomputing




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.