Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="server = localhost; Initial Catalog=helpdesk;integrated security=SSPI;Connect Timeout=15;Network Library=dbmssocn;"/>
</appSettings>
<system.web>
<authentication mode="Windows" />
<authorization>
<allow roles="Domain\Domain Admins, Domain\Finance Group"/>
<deny users="*"/>
</authorization>
<identity impersonate="true" />
</system.web>
</configuration>
Dim ConnectionString As String = "server=(local);database=helpdesk;trusted_connection=true"
'Global Declaration
Dim user As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent
Dim strUser As String = user.name
'Place Page_Load events here
'Click of a button
Sub quickUpdate_Click(sender As Object, e As System.EventArgs)
'Append to Users Input their domain name as entered into tables - No need to use substring if you want entire domain credentials
Dim upText As String = Update.Text & " - " & strUser.Substring(strUser.IndexOf("\") + 1)
Dim myConnection As New SqlConnection(ConnectionString)
Dim UpdateCommand As SqlCommand = new SqlCommand()
UpdateCommand.Connection = myConnection
UpdateCommand.CommandText = "INSERT INTO tblIncHist(IncidentID, IncHistDate, IncHistDetails, IncStatus) VALUES (@IncidentID, GetDate(), '" & Replace(upText, "'", "''") & "', @StatusID)"
UpdateCommand.Parameters.Add("@IncidentID", SqlDbType.Int, 4).Value = IncidentID
UpdateCommand.Parameters.Add("@StatusID", SqlDbType.Int, 4).Value = statID
' execute the command
Try
myConnection.Open()
UpdateCommand.ExecuteNonQuery()
Catch ex as Exception
Message.Text = ex.ToString()
Finally
myConnection.Close()
End Try
BindDetailGrid()
End Sub
<%@ Page Language="VB" debug="true"%>
<script language="VB" runat="server">
Sub Page_Load(Sender as Object, E as EventArgs)
Dim user As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent
Dim strUser As String = user.name
myLabel.Text = strUser
myLabel2.Text = strUser.Substring(strUser.IndexOf("\") + 1)
End Sub
</script>
<html>
<head>
<title>I Know Who You Are</title>
</head>
<body>
<form runat="server">
You are: <asp:Label id=myLabel runat=server /><br>
Or also known as: <asp:Label id=myLabel2 runat=server />
</form>
</html>
Sub Page_Load(Sender As Object, e As EventArgs)
If strUser <> "" Then
strUser = strUser.Substring(strUser.IndexOf("\") + 1)
Dim myConnection As New SqlConnection(ConnectionString)
Dim SelectCommand As String = "SELECT ClientID, ClientName, ClientNetworkID FROM tblClients WHERE NetworkID LIKE '" & strUser & "'"
Dim myAdapter As SqlDataAdapter = New SqlDataAdapter(myCommand)
Dim dataset As DataSet = New DataSet()
myAdapter.Fill(dataset)
Try
userTxt.Text = dataset.tables(0).rows(0).item("ClientName")
Catch ex as Exception
userTxt.Text = "Your login has not been entered into our Database. Please contact the Help Desk to correctly use the features of the Intranet"
ViewState("denied") = "True"
Finally
myConnection.Close()
End Try
End If
If ViewState("denied") <> "" Then
Exit Sub
Else
'Continue loading the rest of the page
End If