Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help getting started 1

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
US
I posted earlier regarding looking for some sample code to query Active Directory for a user's phone number. I am finding lots of sample bits of code on CodeProject.com but nothing that is even close to explaining to me how to even get started.

I'm also trying to find what I need on W3Schools but again coming up very empty.

I guess I need to start at the most base levels here. What program do people recommend to code in? I have access to Visual Web Developer, Microsoft Expression Web 4 and Web Matrix.

I used to do all my classic ASP in a simple notepad session, so I am feeling rather lost here in not understanding the file structure needed.

I don't understand why this works inside my aspx file
Code:
You are <%=Request.ServerVariables("LOGON_USER")%>
But this does not
Code:
	<SCRIPT type="text/vbscript" language="vbscript">
		User = Request.ServerVariables("LOGON_USER")
		Response.Write User
	</Script>

Can anyone assist with some basic code to get me started?

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 

This script is executed on the client

Code:
<SCRIPT type="text/vbscript" language="vbscript">
        User = Request.ServerVariables("LOGON_USER")
        Response.Write User
    </Script>

whereas this script is executed on the server prior to being sent to the client
Code:
<%=Request.ServerVariables("LOGON_USER")%>

The best way to describe server-side code would is that the page is being created in the server's memory and once all the server-side code and code-behind is executed, the resultant page is delivered to the client. Client-side script (VBScript, javascript, etc.) is executed on the client machine just like classic asp.

Some things are only available on the server, for example the Request object. Request.ServerVariables contains a slew of information about where the request came from and what user is making the request for IIS to serve up the page. If the web site is set up for Windows authentication, the LOGON_USER property will be populated with the Active Directory user name of the user trying to access the page. If the user does not have a valid AD account, the access will be denied. If Anonymous access to the web site is allowed, the username will not be populated since the access will be granted regardless of whether the user has an Active Directory user account.

I do have a preference for Visual Studio 2010 in developing web applications. I use it exclusively along with SQL Server. Both of which come in the "express" versions which makes learning a whole lot less expensive...



Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Thanks Mark, I always thought that <script> and <%> did the same thing but from your post I gather the latter deliniates that the code is sever side?

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 

It does. The runat="server" tag in the HTML code also allows the object to be manipulated in the code-behind.

For example:
Code:
<asp:Label runat="server" id="lblTitle"></asp:Label>

allows you to change the text within the label using code:

Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        lblTitle.Text = "Hello world"
End Sub


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top