954,315 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

IIS 7,VS 2008,Windows Server 2008...

Erm, do I need Visual Studio in my Windows Server 2008 to make my website work? Somehow,I've set my Content Directory and my Visual Directory to the same folder with all my ASP.NET pages + codes inside but it doesn't work at all. Tried switching authentication mode to forms authentication. Enable directory browsing and all that but it doesn't work too. How am I suppose to go about doing it?

This is my web.config codes

<?xml version="1.0"?>
.web>
.codedom>

.webServer>

My login code behind codes

Imports System.DirectoryServices
Partial Public Class Login
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub
Private Function ValidateActiveDirectoryLogin(ByVal Domain As String, ByVal Username As String, ByVal Password As String) As Boolean
Dim Success As Boolean = False
Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://WIN-O0WXTK9XZU0.App2.ict.np.edu.sg/DC=App2,DC=ict,DC=np,DC=edu,DC=sg" & Domain, Username, Password)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
'Try
' Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
' Success = Not (Results Is Nothing)
'Catch
' Success = False
'End Try

Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Results Is Nothing)
Return Success
End Function
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLogin.Click
Dim isauthenticated As Boolean = AuthenticateUser()
If isAuthenticated Then
Response.Redirect("Default.aspx?")
Else
'code here to display incorrect login details
lblError.Text = "Please enter correct username and password"
End If
End Sub

Private Function AuthenticateUser() As Boolean
Dim username As String = txtUsername.Text
Dim password As String = txtPassword.Text
'Dim domain As String = this can be in a config file, hard coded (I wouldnt do that), or inputed from the UI
Dim domain As String = "App2.ict.np.edu.sg"

Dim isAuthenticated As Boolean = ValidateActiveDirectoryLogin(domain, username, password)

Return isAuthenticated
End Function
End Class

SiahCheePing
Newbie Poster
9 posts since May 2010
Reputation Points: 10
Solved Threads: 1
 

>>Erm, do I need Visual Studio in my Windows Server 2008 to make my website work?
No

>>Somehow,I've set my Content Directory and my Visual Directory to the same folder with all my ASP.NET pages + codes inside but it doesn't work at all
Visual directory? Do you mean virtual directory? You shouldn't have multiple directories pointed to the same physical store (certain exclusions apply).

>>Tried switching authentication mode to forms authentication. Enable directory browsing and all that but it doesn't work too
What is your question? In general are the changes made inside of IIS not being reflected when you browse the site?

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 

Thanks. I've solved the issue

SiahCheePing
Newbie Poster
9 posts since May 2010
Reputation Points: 10
Solved Threads: 1
 

Can you please let us know how you solved this issue?

iis74u
Newbie Poster
1 post since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You