 |
|
ช่วยด้วยครับ ASP.Net IIS Uh-oh, something went wrong! Error Code: 500 |
|
 |
|
|
 |
 |
|
500 เป็น invalid code ครับ บอกแค่นี้ไม่รู้หรอกครับว่าต้องแก้ยังไง เอาโค๊ดมาแปะ ครับ จะได้ช่วยกันดูว่าผิดตรงไหน
|
 |
 |
 |
 |
Date :
2014-09-09 12:17:41 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันนี้หน้า แรกนะครับ Default.aspx.vb
Code (VB.NET)
Imports System.Data
Imports MySql.Data.MySqlClient
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblTitle.Text = "ยินดีต้อนรับสู่ TMN Billing"
Me.Title = "TMN Bill"
Call condef()
Dim ds1 As New DataSet
Dim da1 As New MySqlDataAdapter
da1.SelectCommand = New MySqlCommand("select * from tblemployee", MyCon)
da1.Fill(ds1, "tblemployee")
DropDownList1.DataSource = ds1.Tables("tblemployee")
DropDownList1.DataTextField = "EmpName"
DropDownList1.DataValueField = "EmpID"
DropDownList1.DataBind()
End Sub
'Public EmpName As String = ""
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLog.Click
If txtPass.Text = "" Or DropDownList1.Text = "" Then
lblAlert.Text = "กรุณากรอกข้อมูล"
Exit Sub
End If
condef()
Dim ds As New DataSet
Dim da As New MySqlDataAdapter
da.SelectCommand = New MySqlCommand("select * from tblemployee where EmpID='" & DropDownList1.SelectedItem.Text & "' and Password='" & txtPass.Text & "'", MyCon)
da.Fill(ds, "tblemployee")
If ds.Tables("tblemployee").Rows.Count < 1 Then
lblAlert.Text = "User / Password Is wrong! ชื่อผู้ใช้ หรือ รหัสผ่านไม่ถูกต้อง"
EmpName = ""
txtPass.Text = ""
KeeperID = ""
'DropDownList1.Text = ""
Else
EmpName = ds.Tables("tblemployee").Rows(0).Item("EmpName").ToString
KeeperID = ds.Tables("tblemployee").Rows(0).Item("KeeperID").ToString
lblAlert.Text = "ยินดีต้อนรับ " & EmpName
Me.Title = "ยินต้อนรับคุณ " & EmpName
Response.Redirect("LoginSucess.aspx")
txtPass.Text = ""
'DropDownList1.Text = ""
End If
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DropDownList1.SelectedIndexChanged
End Sub
End Class
อันนี้ เป็นหน้า ดีไซน์ครับ Default.aspx
Code (ASP)
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ASP_Test._Default" %>
<!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 runat="server">
<title></title>
<style type="text/css">
.style1
{
text-align: center;
}
</style>
</head>
<body >
<form id="form1" runat="server" >
<div style="font-weight: 700; font-size: xx-large;" class="style1"
align="center">
<br />
<asp:Image ID="Image1" runat="server" Height="108px" Width="196px"
ImageUrl="~/logo.bmp"/>
<br />
<asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label>
<br />
</div>
<div class="style1" align="center">
<asp:Label ID="lblAlert" runat="server" ForeColor="#FF6600"></asp:Label>
</div>
<div class="style1" align="center" >
<table align="center" style="background-color:Lime" border="1">
<tr>
<td><asp:Label ID="Label3" runat="server" Text="UserID / ชื่อผู้ใช้" Font-Size=Larger></asp:Label></td>
<td><asp:DropDownList ID="DropDownList1" runat="server" Width="200px" Font-Size="Larger" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AppendDataBoundItems="true"> </asp:DropDownList></td>
</tr>
<tr>
<td><asp:Label ID="Label2" runat="server" Text="Password / รหัสผ่าน" Font-Size=Larger></asp:Label></td>
<td><asp:TextBox ID="txtPass" runat="server" CssClass="style1" Font-Size=Larger TextMode=Password Width="200px"></asp:TextBox></td>
</tr>
<tr>
<td style="border" colspan="2">
<asp:Button ID="btnLog" runat="server" Text="Login" Font-Size="Larger"
BorderStyle="Outset" Width="231px" Height="100%" />
</td>
</tr>
</table>
</div>
<div class="style1" align="center">
</div>
</form>
</body>
</html>
|
 |
 |
 |
 |
Date :
2014-09-09 12:30:59 |
By :
zarooman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รันผ่าน Visual Development Server ได้ครับแต่พอ Publish ไปรันผ่าน IIS มันขึ้น error 500 อะครับ
|
ประวัติการแก้ไข 2014-09-09 12:34:30
 |
 |
 |
 |
Date :
2014-09-09 12:33:57 |
By :
zarooman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|