Hi all,

i m developing a web portal whcih can be accesed over intranet.i need to inbuild a feature that the webpage will take authentication frm windows login.
eg. i log to the terminal server adn opens the link ,the webpage should be able to authenticate the windows login and proceed further.

in this only i also want to show an excel sheet within the webpage .how can i do this task .

Please help me out in this .

Thanks in advacne
Mukul

Dani AI

Generated

Short summary and practical plan (building on and ): static HTML alone cannot capture a Windows logon. For intranet single-sign-on the site must run on a server that supports Integrated Windows Authentication (IIS is the usual choice), the server and clients must be in the same Active Directory/trust boundary, and a bit of server-side code is required to get the authenticated username for personalization or authorization.

Quick implementation checklist

  • Host the site on IIS on a machine joined to the domain (or use a backend that can authenticate against AD).
  • In IIS, disable Anonymous Authentication and enable Windows (Integrated) Authentication. For Kerberos, ensure the Negotiate provider is used and register SPNs if the hostname differs from the machine account.
  • For an ASP.NET app, enable Windows auth in web.config and deny anonymous access:
<system.web>
  <authentication mode="Windows" />
  <authorization>
    <deny users="?" />
  </authorization>
</system.web>
  • Server-side access to the identity (example for .NET): use HttpContext.Current.User.Identity.Name (or User.Identity.Name in MVC) to get DOMAIN\username for custom logic.

Displaying an Excel sheet inside the page

  • If the goal is read-only display on an intranet, convert Excel to HTML on the server (Open XML / ClosedXML / NPOI) and render a table.
  • For client-side display without server conversion, use a browser-side library such as SheetJS (xlsx) to parse an uploaded .xlsx and inject HTML. Minimal example:
<input id="file" type="file">
<div id="sheet"></div>
<script src="xlsx.full.min.js"></script>
<script>
document.getElementById('file').addEventListener('change', function(e){
  var r=new FileReader();
  r.onload=function(ev){
    var wb=XLSX.read(ev.target.result,{type:'array'});
    document.getElementById('sheet').innerHTML =
      XLSX.utils.sheet_to_html(wb.Sheets[wb.SheetNames[0]]);
  };
  r.readAsArrayBuffer(e.target.files[0]);
});
</script>

Notes and gotchas

  • Clients will get a credential prompt unless the site is in the browser’s intranet/trusted zone (Firefox needs network.negotiate-auth.trusted-uris set).
  • If the web server needs to call other services on behalf of the user (double-hop), configure constrained delegation or use a service account.
  • For simple access control only, the IIS-only approach is sufficient; for personalization or custom logic, add the server-side code shown above.
  • For ’s Terminal Server scenario, ensure domain membership or an AD trust so terminal credentials are valid for the web host.

Recommended Answers

All 4 Replies

i m developing a web portal whcih can be accesed over intranet.i need to inbuild a feature that the webpage will take authentication frm windows login.

Asuming a windows network.... The easiest way to do this is to run your website on IIS, disable anonymous authentication, enable Windows authentication.

If you web site is running ASP or ASP.NET, you can easily capture the user's username via Request.ServerVariables.

VB: Request.ServerVariables("LOGON_USER")
C#: Request.ServerVariables["LOGON_USER"]

If not, you can use Forms Based Authentication (ASP.NET), or build your own authentication system.

What server side scripting language are you running on your site, or planning to run?

If it is just a matter of access control, changing the IIS settings for the website will suffice, and you shouldn't need to make any changes to the actual site. If you want to be able to identify the actual user and do something with that information on the website it self like custom options etc, then you can do something like JorgeM suggested.

Hi Pixelsoul and JorgeM,

Thanks for teh reply .
i have developed the site with simple HTML and CSS.and planning to host it from a server say server A.and what i exactly need to build is ,we have a terminal server where some users have login credentials .i need that those credentials can be used in my site for authentication ,i'e users having access on terminal server can only login to the site with there credentials.
is it possible in any way ,
if yes then please help me out .

Yhanks
Mukul

Not possible with HTML alone if you want to identify the user within your web application.

If you simply want to make sure that authenticated users can access the app, you can do so by running your site on IIS and enabling Windows Authentication.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.