Classic asp function

  • Thread starter Thread starter aroth
  • Start date Start date
A

aroth

Hello all, I am just getting started with .net development and have
been playing with various sample apps. I am currently trying to
replicate a function that I have used in my classic asp apps that gets
a user's ntlogin. I normally store it in include file and then run it
before the page loads. Seems simple enough but I can't figure out how
to get it to work with asp.net. For instance, where do I store the
function & how do I call it?
I realize that I will probably get responses sending me to Microsoft's
site and believe me I have been there. What would be helpful is if
anyone knows of a high-level reference comparing the differences
between classic asp and asp.net. Thanks!


include file code:
<script language=jscript runat=server>
function getNTLogin() {
if (Request.ServerVariables("logon_user")=="") {
Response.Status = "401 Auth requested";
Response.End();
} else {
fullLogin = Request.ServerVariables("logon_user") + "";
tmpArray = fullLogin.split("\\");
ntLogin = tmpArray[1];
ntLogin.toLowerCase();
}
return ntLogin;
}
</script>

============================
then my asp page:

<%@ Language=JScript %>
<!-- #include file="inc/include.inc" -->

<% ntlogin = getNTLogin(); %>
<html>
blah blah
display login here: <%=ntlogin%>
 
You could create a class with some static functions:
public class MyFunctions
{
private sub New()
{
// Private Constructor
}

public static string GetUserName()
{
// Implementation
}
}

You could use this function without instantiating the class.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
 
Back
Top