Solved

html

Posted on 2011-09-07
5
230 Views
Last Modified: 2012-05-12
I have never worked in .net or html environment. I am trying to add a button on a html page that runs a vbscript. Also, I need to add a link on html that would only allow certain people have access to the link. Is there anyway that link would only let the domain admins to open it?

Thanks,
Paul
0
Comment
Question by:pauledwardian
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:jagrut_patel
ID: 36500979
For Button that runs VBScript look this link. It also shows example so should be easy for you to copy that in your web-page.
http://www.csidata.com/custserv/onlinehelp/vbsdocs/vbs9.htm

For admin specific link you will need to write some ASP.NET code.

In your ASPX web-page put the following,

<asp:LinkButton ID="AdminLink" Text="Only for Admin" runat="server" Visible="false"></asp:LinkButton>

In your code-behind (aspx.cs) of that page write

protected void Page_Load(object sender, EventArgs e)
{
    bool isAdminUser = false;
    //Put code that determines whether current user is Admin. If user is Admin set isAdminUser = true;            
    AdminLink.Visible = isAdminUser;
}

Open in new window


HTH!

0
 
LVL 9

Expert Comment

by:djpazza
ID: 36529096
Is it asp.net your are after or vb script asp?
0
 

Author Comment

by:pauledwardian
ID: 36533116
Bacially, I need it to run a vbscript. But only lets the domain admins to run it from the html.
0
 
LVL 9

Accepted Solution

by:
djpazza earned 500 total points
ID: 36535224
I'm not sure what your after here.  Firstly you can not run vb script from just html you need a server side scripting language like asp,aspx.

If it a vb file (.vbs) that you need to run just as admins then put the scripts in a folder and only give admins access to the folder.

If you have vb script inside an asp page then you could restrict access to the page(s) using your webserver e.g iis.  On the security options use windows authenction and give admins permission to the web folder.  This way they will authenticate automatically using their windows credentials but other users with get a login prompt.

The other option is to still user windows authentication as this gives you access to some variables to query ad via a script using ldap.

The attached code will only display domain admin information if the current user is in the domain admin group.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'Get Groups
Dim objNetwork, objUser, CurrentUser
Dim strGroup

	Const backup_Group = "cn=domain admins"

	Set objNetwork = CreateObject("WScript.Network")
	Set objUser = CreateObject("ADSystemInfo")
	Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
	strGroup = LCase(Join(CurrentUser.MemberOf))
	'response.Write strGroup

  If InStr(strGroup,backup_Group) Then
    session("auth") = "True"
  End If
  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Restrict Access</title>
</head>

<body>
<div style="margin-bottom:30px;">All Users can see this content</div>
<% if session("auth") = "True" then %>
<div style="margin-bottom:30px;">Only admins can see this content</div>
<% end if %>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:pauledwardian
ID: 36547115
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Runtime Error 2 28
Two different visual studio versions 3 21
Server Error 11 47
Footer at the bottom of the page not centered 5 28
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now