Solved

html

Posted on 2011-09-07
5
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

623 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