Hello There, Guest!
View New Posts  |  View Today's Posts
[VB.Net] MasterPage Issue ?

  • 0 Vote(s) - 0 Average


12-26-2015, 01:06 PM #1
Imad
Junior Member
**
Posts: 4 Threads:3 Joined: Oct 2015 Reputation: 0

MasterPage Issue ?
EDIT : I fixed the first SQL issue . now I'm having something else I guess it's related to directories or something like that .

now I 'm having some issues , (I googled and I found that it has something with directories or something I assume) , the code is the following :

Code:
Imports System.Data.SqlClient
Imports System.Net
Imports System.Security.Cryptography
Imports System.IO

Partial Class Basket
   Inherits System.Web.UI.MasterPage

   Dim hyp_reader As String = "Server=xx.xxx.xxx.xx;" & _
         "Uid=$l@rys;"  & _
                 "Pwd=A5lK7m"
   Dim hyp_updater As String =  "Server=xx.xxx.xxx.xx;" & _
         "Uid=$l@rys;"  & _
                 "Pwd=A5lK7m"
   Dim fyben_reader As String =  "Server=xx.xxx.xxx.xx;" & _
         "Uid=$l@rys;"  & _
                 "Pwd=A5lK7m"
   Dim fyben_updater As String =  "Server=xx.xxx.xxx.xx;" & _
         "Uid=$l@rys;"  & _
                 "Pwd=A5lK7m"
   Dim fyben_writer As String =  "Server=xx.xxx.xxx.xx;" & _
         "Uid=$l@rys;"  & _
                 "Pwd=A5lK7m"
   Dim char_reader As String = "Server=xx.xxx.xxx.xx;" & _
         "Uid=$l@rys;"  & _
                 "Pwd=A5lK7m"

   Private Sub Page_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       Try
           Using saConn_sub As New SqlConnection(fyben_updater)
               Dim query_sub As String = "UPDATE fybens_lair_website.dbo.page_views SET page_views = page_views + 1"
               Dim cmd_sub As New SqlCommand(query_sub, saConn_sub)

               saConn_sub.Open()
               cmd_sub.ExecuteNonQuery()
               saConn_sub.Close()
           End Using

           ' Check wether or not user is logged in
           Dim cookie As HttpCookie = Request.Cookies(Encrypt("Username"))

           If Not cookie Is Nothing Then
               logged_in.Visible = True
               login_box_panel.Visible = False
               logged_out_links.Visible = False
               grab_p_pic(Decrypt(Request.Cookies(Encrypt("Username")).Value))

               get_unread_count()
               get_unread_mail_count()

               If display_admin_controls(Decrypt(Request.Cookies(Encrypt("Username")).Value)) = True Then
                   adm_1.Visible = True
                   adm_2.Visible = True
                   adm_3.Visible = True
                   adm_4.Visible = True
                   adm_5.Visible = True
                   adm_6.Visible = True
                   get_mod_ticket_unread_count()
               End If
               If display_mod_controls(Decrypt(Request.Cookies(Encrypt("Username")).Value)) = True Then
                   adm_2.Visible = True
                   get_mod_ticket_unread_count()
               End If

               logged_username.Text = "WELCOME, <a href='/profile.aspx?user=" & Decrypt(Request.Cookies(Encrypt("Username")).Value) & "'>" & Decrypt(Request.Cookies(Encrypt("Username")).Value).ToUpper & "</a>!"
           End If

           ' Highlighting navigation
           highlight_navi()
           ' Grabbing the time
           get_time()
           ' Fetch the red news
           read_red_news()
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Private Function display_admin_controls(Optional ByVal username As String = "") As Boolean
       Try
           ' Check wether we're looking for admin controls on default or target
           If username = "" Then
               username = Decrypt(Request.Cookies(Encrypt("Username")).Value)
           End If

           ' We simply pull the has_webadmin from the db and return wether true (admin) or false (not admin)
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT has_webadmin FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & username & "'"
               saConn.Open()
               Dim cmd2 As New SqlCommand(query, saConn)
               Using saReader As SqlDataReader = cmd2.ExecuteReader
                   Do While saReader.Read
                       If saReader("has_webadmin") = "1" Then
                           Return True
                       End If
                   Loop
               End Using
               saConn.Close()
           End Using
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Function

   Private Function display_mod_controls(Optional ByVal username As String = "") As Boolean
       Try
           ' Check wether we're looking for admin controls on default or target
           If username = "" Then
               username = Decrypt(Request.Cookies(Encrypt("Username")).Value)
           End If

           ' We simply pull the has_webadmin from the db and return wether true (admin) or false (not admin)
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT has_webadmin FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & username & "'"
               saConn.Open()
               Dim cmd2 As New SqlCommand(query, saConn)
               Using saReader As SqlDataReader = cmd2.ExecuteReader
                   Do While saReader.Read
                       If (saReader("has_webadmin") = "1") Or (saReader("has_webadmin") = "2") Then
                           Return True
                       End If
                   Loop
               End Using
               saConn.Close()
           End Using
       Catch ex As Exception
           submitError(ex.Message)
       End Try

   End Function

   Private Function grab_p_pic(ByVal username As String) As Boolean
       Try
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT profile_pic_url FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & SafeSqlLiteral(username) & "'"
               Dim cmd As New SqlCommand(query, saConn)

               saConn.Open()

               Using saReader As SqlDataReader = cmd.ExecuteReader
                   While saReader.Read
                       profile_pic_url.ImageUrl = saReader("profile_pic_url")
                   End While
               End Using
               saConn.Close()
           End Using
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Function

   Private Function convert_time(ByVal input As String) As String
       Dim dt = DateTime.ParseExact(input, "dd-MM-yyyy HH:mm:ss", Nothing)
       Dim posted_on As DateTime = dt

       Dim diff1 As System.TimeSpan

       diff1 = DateTime.UtcNow.Subtract(posted_on)

       ' If seconds are less than a full minute
       If diff1.TotalSeconds < 60 Then
           Return "Just now"

           ' If minutes are less than 2
       ElseIf diff1.TotalMinutes < 2 Then
           Return "About a minute ago"

           ' If minutes are more than 1 and less than 10
       ElseIf diff1.TotalMinutes < 10 And diff1.TotalMinutes > 1 Then
           Return "About " & diff1.TotalMinutes.ToString("#") & " minutes ago"

           ' If minutes are less than half an hour and more than 10
       ElseIf diff1.TotalMinutes < 31 And diff1.TotalMinutes > 9 Then
           Return "About " & diff1.TotalMinutes.ToString("##") & " minutes ago"

           ' If minutes are more than half an hour and less than 2 hours
       ElseIf diff1.TotalMinutes > 31 And diff1.TotalMinutes < 120 Then
           Return "About an " & diff1.TotalHours.ToString("#") & " hour ago"

           ' If hours are more than 1 and less than 13
       ElseIf diff1.TotalHours > 1 And diff1.TotalHours < 13 Then
           Return "Today, " & diff1.TotalHours.ToString("##") & " hours ago"

           ' If hours are more than 1 and less than 25
       ElseIf diff1.TotalHours > 12 And diff1.TotalHours < 25 Then
           Return diff1.TotalHours.ToString("##") & " hours ago"

           ' If days are more or equal to 1 and less than 3
       ElseIf diff1.TotalDays >= 1 And diff1.TotalDays < 3 Then
           Return "Yesterday, " & diff1.TotalHours.ToString("##") & " hours ago"

           ' If two days to ten days and less than a week (just format)
       ElseIf diff1.TotalHours > 48 And diff1.TotalDays < 7 Then
           Return diff1.TotalDays.ToString("#") & " days ago"

           ' If more than 7 days (just format to weeks)
       ElseIf diff1.TotalDays > 6 And diff1.TotalDays < 14 Then
           Return "A week ago"

           ' If more than 1 week
       ElseIf diff1.TotalDays > 13 Then
           Return (diff1.TotalDays / 7).ToString("#") & " weeks ago"
       End If
   End Function

   Public Sub read_red_news()
       Try
           ' Select the most recently posted red news
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT TOP(1) * FROM fybens_lair_website.dbo.db_red_news ORDER BY ui DESC"

               saConn.Open()
               Dim cmd2 As New SqlCommand(query, saConn)
               Using saReader As SqlDataReader = cmd2.ExecuteReader
                   If saReader.HasRows Then
                       Do While saReader.Read
                           must_see.Text = "<a href='" & saReader("link") & "'>" & saReader("message") & ", click here to read more.</a> (" & convert_time(saReader("date")) & ")"
                       Loop
                   Else
                       must_see.Text = "There seems to be no news yet.. Perhaps we wait."
                   End If
               End Using
               saConn.Close()
           End Using

           Dim cookie As HttpCookie = Request.Cookies(Encrypt("Username"))
           If Not cookie Is Nothing Then
               Using saConn As New SqlConnection(fyben_reader)
                   Dim query As String = "SELECT currency FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & Decrypt(cookie.Value) & "'"
                   Dim cmd As New SqlCommand(query, saConn)
                   saConn.Open()
                   Using saReader As SqlDataReader = cmd.ExecuteReader()
                       While saReader.Read()
                           user_gem_count.Text = saReader("currency")
                       End While
                   End Using
                   saConn.Close()
               End Using

               Using saConn As New SqlConnection(fyben_reader)
                   Dim query As String = "SELECT vote_currency FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & Decrypt(cookie.Value) & "'"
                   Dim cmd As New SqlCommand(query, saConn)
                   saConn.Open()
                   Using saReader As SqlDataReader = cmd.ExecuteReader()
                       While saReader.Read()
                           user_coin_count.Text = saReader("vote_currency")
                       End While
                   End Using
                   saConn.Close()
               End Using
           End If
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Public Sub get_time()
       Try
           server_time.Text = "Server time: " & DateTime.UtcNow.ToString("HH:mm")
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Public Sub highlight_navi()
       Try
           Dim q As String = Page.Title.ToUpper

           If q.Contains("INDEX") Then
               home_link.Attributes.CssStyle.Add("opacity", "0")
               location_label.Text = "<a href='/index.aspx'>" & _
                                   Page.Title.Replace("Team Hyperion™ ::", "").Replace("| Bringing the battle to you!", "") & _
                                   "</a>"
           ElseIf q.Contains("FORUM") Then
               forum_link.Attributes.CssStyle.Add("opacity", "0")
               location_label.Text = "<a href='/forum.aspx'>" & _
                                   Page.Title.Replace("Team Hyperion™ ::", "").Replace("| Bringing the battle to you!", "") & _
                                   "</a>"
           ElseIf q.Contains("REGISTER") Then
               register_link.Attributes.CssStyle.Add("opacity", "0")
               location_label.Text = "<a href='/register.aspx'>" & _
                                   Page.Title.Replace("Team Hyperion™ ::", "").Replace("| Bringing the battle to you!", "") & _
                                   "</a>"
           ElseIf q.Contains("DOWNLOAD") Then
               download_link.Attributes.CssStyle.Add("opacity", "0")
               location_label.Text = "<a href='/download.aspx'>" & _
                                   Page.Title.Replace("Team Hyperion™ ::", "").Replace("| Bringing the battle to you!", "") & _
                                   "</a>"
           ElseIf q.Contains("ROSTER") Then
               roster_link.Attributes.CssStyle.Add("opacity", "0")
               location_label.Text = "<a href='/roster.aspx'>" & _
                                   Page.Title.Replace("Team Hyperion™ ::", "").Replace("| Bringing the battle to you!", "") & _
                                   "</a>"
           Else
               location_label.Text = "<a href='#'>" & _
                                   Page.Title.Replace("Team Hyperion™ ::", "").Replace("| Bringing the battle to you!", "") & _
                                   "</a>"
           End If
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Public Function SafeSqlLiteral(ByVal strValue As String, Optional ByVal intLevel As Integer = 2) As String

       If Not IsDBNull(strValue) Then
           If intLevel > 0 Then
               strValue = Replace(strValue, "'", "''")
               strValue = Replace(strValue, "--", "")
               strValue = Replace(strValue, "[", "[[]")
               strValue = Replace(strValue, "%", "[%]")
           End If

           If intLevel > 1 Then
               Dim myArray As Array
               myArray = Split("xp_ ;update ;insert ;select ;drop ;alter ;create ;rename ;delete ;replace ", ";")
               Dim i, i2, intLenghtLeft As Integer
               For i = LBound(myArray) To UBound(myArray)
                   Dim rx As New Regex(myArray(i), RegexOptions.Compiled Or RegexOptions.IgnoreCase)
                   Dim matches As MatchCollection = rx.Matches(strValue)
                   i2 = 0
                   For Each match As Match In matches
                       Dim groups As GroupCollection = match.Groups
                       intLenghtLeft = groups.Item(0).Index + Len(myArray(i)) + i2
                       strValue = Left(strValue, intLenghtLeft - 1) & "&nbsp;" & Right(strValue, Len(strValue) - intLenghtLeft)
                       i2 += 5
                   Next
               Next
           End If

           strValue = Replace(strValue, ";", ";&nbsp;")
           strValue = Replace(strValue, "_", "[_]")
       End If

       Return strValue

   End Function

   Public Function CalculateMD5Hash(input As String) As String
       Dim md5 As MD5 = System.Security.Cryptography.MD5.Create()
       Dim inputBytes As Byte() = System.Text.Encoding.ASCII.GetBytes("2011" & input)
       Dim hash As Byte() = md5.ComputeHash(inputBytes)
       Dim sb As New StringBuilder()
       For i As Integer = 0 To hash.Length - 1
           sb.Append(hash(i).ToString("x2"))
       Next
       Return sb.ToString()
   End Function

   Public Sub login_process()
       username_notfound.Text = ""
       password_incorrect.Text = ""

       Try
           If user_exist(SafeSqlLiteral(login_username.Text)) = True Then
               If pass_ok(SafeSqlLiteral(login_password.Text)) = True Then

                   If is_banned(SafeSqlLiteral(login_username.Text)) = True Then
                       Response.Redirect("banned.aspx?u=" & login_username.Text)
                       Exit Sub
                   End If

                   ' Fetch the user IP
                   Dim ExternalIP As String
                   ExternalIP = (New WebClient()).DownloadString("http://checkip.dyndns.org/")
                   ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")) _
                                .Matches(ExternalIP)(0).ToString()

                   ' Update the last logged IP and date
                   Using saConn As New SqlConnection(fyben_updater)
                       Dim query As String = "UPDATE fybens_lair_website.dbo.db_web_profile SET security_login = '" & DateTime.UtcNow.ToString("dd-MM-yyyy HH:mm:ss") & "', last_login_ip = '" & ExternalIP & "' WHERE username = '" & SafeSqlLiteral(login_username.Text) & "'"

                       saConn.Open()

                       Dim cmd2 As New SqlCommand(query, saConn)
                       cmd2.ExecuteNonQuery()

                       saConn.Close()
                   End Using

                   Dim q As New HttpCookie(Encrypt("Username"))
                   With q
                       .Value = Encrypt(login_username.Text)
                       .Expires = DateTime.UtcNow.AddYears(1)
                   End With

                   Dim w As New HttpCookie(Encrypt("Login_posted"))
                   With w
                       .Value = Encrypt("0")
                       .Expires = DateTime.UtcNow.AddYears(1)
                   End With
                   
                   Response.Cookies.Add(q)
                   Response.Cookies.Add(w)

                   ' Just refresh the page
                   Response.Redirect(Request.RawUrl)

               Else
                   password_incorrect.Text = "Password incorrect"
               End If
           Else
               username_notfound.Text = "Username not found"
           End If
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Private Function user_exist(ByVal username As String) As Boolean
       Try
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT COUNT(*) AS 'count' FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & username & "'"
               Dim cmd As New SqlCommand(query, saConn)

               saConn.Open()

               Using saReader As SqlDataReader = cmd.ExecuteReader
                   While saReader.Read
                       If saReader("count") = "0" Then
                           Return False
                           Exit Function
                       Else
                           Return True
                           Exit Function
                       End If
                   End While
               End Using
               saConn.Close()
           End Using
           Return False
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Function

   Private Function is_banned(ByVal username As String) As Boolean
       Try
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT is_profilebanned FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & username & "'"
               Dim cmd As New SqlCommand(query, saConn)

               saConn.Open()

               Using saReader As SqlDataReader = cmd.ExecuteReader
                   While saReader.Read
                       If saReader("is_profilebanned") = "1" Then
                           Return True
                       Else
                           Return False
                       End If
                   End While
               End Using
               saConn.Close()
           End Using
           Return False
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Function

   Private Function pass_ok(ByVal password As String) As Boolean
       Try
           Using saConn As New SqlConnection(hyp_reader)
               Dim query As String = "SELECT password FROM Auth.dbo.Accounts WHERE login_name = '" & SafeSqlLiteral(login_username.Text) & "'"
               Dim cmd As New SqlCommand(query, saConn)
               Try
                   saConn.Open()
               Catch ex As Exception
                   MsgBox("Web server seems to be offline, please try again later.", MsgBoxStyle.Critical, "Webserver offline!")
                   Return Nothing
                   Exit Function
               End Try

               Using saReader As SqlDataReader = cmd.ExecuteReader
                   While saReader.Read
                       If saReader("password") = CalculateMD5Hash(password) Then
                           Return True
                           Exit Function
                       Else
                           Return False
                           Exit Function
                       End If
                   End While
               End Using
               saConn.Close()
           End Using
           Return False
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Function

   Public Sub get_unread_count()
       Try
           Dim cookie As HttpCookie = Request.Cookies(Encrypt("Username"))

           If Not cookie.Value Is Nothing Then
               Using saConn As New SqlConnection(fyben_reader)
                   Dim query As String = "SELECT COUNT(*) AS 'count' FROM fybens_lair_website.dbo.db_ticket_convo WHERE is_read = 0 AND receiver ='" & Decrypt(cookie.Value) & "'"

                   saConn.Open()

                   Dim cmd2 As New SqlCommand(query, saConn)
                   Using saReader As SqlDataReader = cmd2.ExecuteReader
                       If saReader.HasRows Then
                           Do While saReader.Read
                               If saReader("count") = "0" Then
                                   unread_answers.Text = ""
                               Else
                                   unread_answers.Text = "(" & saReader("count") & ")"
                               End If
                           Loop
                       Else
                           unread_answers.Text = ""
                       End If
                   End Using
                   saConn.Close()
               End Using
           End If
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Public Sub get_unread_mail_count()
       Try
           Dim cookie As HttpCookie = Request.Cookies(Encrypt("Username"))

           If Not cookie Is Nothing Then
               Using saConn As New SqlConnection(fyben_reader)
                   Dim query As String = "SELECT COUNT(*) AS 'count' FROM fybens_lair_website.dbo.db_mailbox WHERE is_read = 0 AND receiver ='" & Session.Item("username") & "'"

                   saConn.Open()

                   Dim cmd2 As New SqlCommand(query, saConn)
                   Using saReader As SqlDataReader = cmd2.ExecuteReader
                       If saReader.HasRows Then
                           Do While saReader.Read
                               If saReader("count") = "0" Then
                                   unread_mail.Text = ""
                               Else
                                   unread_mail.Text = "(" & saReader("count") & ")"
                               End If
                           Loop
                       Else
                           unread_mail.Text = ""
                       End If
                   End Using
                   saConn.Close()
               End Using
           End If
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Public Sub get_mod_ticket_unread_count()
       Try
           Using saConn As New SqlConnection(fyben_reader)
               Dim query As String = "SELECT COUNT(*) AS 'count' FROM fybens_lair_website.dbo.db_ticket_convo WHERE is_read = 0 AND receiver ='admin_ticket_case'"

               saConn.Open()

               Dim cmd2 As New SqlCommand(query, saConn)
               Using saReader As SqlDataReader = cmd2.ExecuteReader
                   If saReader.HasRows Then
                       Do While saReader.Read
                           If saReader("count") = "0" Then
                               ticket_mod_unread.Text = ""
                           Else
                               ticket_mod_unread.Text = "(" & saReader("count") & ")"
                           End If
                       Loop
                   Else
                       ticket_mod_unread.Text = ""
                   End If
               End Using
               saConn.Close()
           End Using
       Catch ex As Exception
           submitError(ex.Message)
       End Try
   End Sub

   Private Sub submitError(ByVal Message As String)
       Try
           Using saConn As New SqlConnection(fyben_writer)

               Dim query As String = "INSERT INTO fybens_lair_website.dbo.db_mailbox " & _
                           " (sender, receiver, message, date, is_read) VALUES " & _
                           " (@sender, @receiver, @message, @date, @is_read)"
               Dim cmd = New SqlCommand(query, saConn)
               With cmd.Parameters
                   .Add(New SqlParameter("@sender", Page.Title))
                   .Add(New SqlParameter("@receiver", "Fyben"))
                   .Add(New SqlParameter("@message", Message))
                   .Add(New SqlParameter("@date", DateTime.UtcNow.ToString("dd-MM-yyyy HH:mm:ss")))
                   .Add(New SqlParameter("@is_read", "0"))
               End With
               saConn.Open()
               cmd.ExecuteNonQuery()
               saConn.Close()
           End Using
       Catch ex As Exception

       End Try
   End Sub

   Private Function Encrypt(ByVal text As String) As String
       Dim hex As String = ""
       For i As Integer = 0 To Text.Length - 1
           hex &= Asc(Text.Substring(i, 1)).ToString("x").ToUpper
       Next
       Return hex
   End Function

   Private Function Decrypt(ByVal hex As String) As String
       Dim text As New System.Text.StringBuilder(Hex.Length \ 2)
       For i As Integer = 0 To Hex.Length - 2 Step 2
           text.Append(Chr(Convert.ToByte(Hex.Substring(i, 2), 16)))
       Next
       Return text.ToString
   End Function

Public Function GET_TOP_5() As String
Try
           Dim is_online = "<font color='#49A952'>»</font>"
           Dim is_offline = "<font color='#d33a3a'>»</font>"
           Dim log_status As String

           Dim char_job_id As String
           Dim char_lev As String
           Dim char_class As String
           Dim char_name_2 As String
           Dim char_acc As String
           Dim char_guild As String
           Dim char_pt As String
           Dim char_fame As String

           Dim g As Integer = 0

           Dim rank As Integer = 1

           Dim returnstring As String

           Using saConn As New SqlConnection(char_reader)
               Dim query As String = "SELECT TOP(5) CHAR_RES.job AS 'job_id', " &
                                         "CHAR_RES.lv AS 'level', " &
                                         "STRRES.value AS 'class', " &
                                         "CHAR_RES.name AS 'char', " &
                                         "CHAR_RES.login_time AS 'login_time', " &
                                         "CHAR_RES.logout_time AS 'logout_time', " &
                                         "CHAR_RES.account AS 'acc', " &
                                         "GUILD.name AS 'guild' " &
                                         "FROM DB_$ol@rys_1.dbo.Character CHAR_RES " &
                                         "LEFT JOIN DB_$ol@rys_1.dbo.GuildMember GMEM " &
                                         "ON GMEM.player_id = CHAR_RES.sid " &
                                         "LEFT JOIN DB_$ol@rys_1.dbo.Guild GUILD " &
                                         "ON GUILD.sid = GMEM.guild_id " &
                                         "INNER JOIN Arcadia.dbo.JobResource JOBRES " &
                                         "ON JOBRES.id = CHAR_RES.job " &
                                         "INNER JOIN Arcadia.dbo.StringResource STRRES " &
                                         "ON STRRES.code = JOBRES.text_id " &
                                         "WHERE CHAR_RES.permission = '0' " &
                                         "ORDER BY CHAR_RES.exp DESC"
               saConn.Open()
               Dim cmd As New SqlCommand(query, saConn)
               Using saReader As SqlDataReader = cmd.ExecuteReader
                   While saReader.Read
                       char_job_id = saReader("job_id")
                       char_lev = saReader("level")
                       char_name_2 = saReader("char")
                       char_acc = saReader("acc")
                       char_class = saReader("class")
                       If IsDBNull(saReader("guild")) Then
                           char_guild = "NONE"
                       Else
                           char_guild = saReader("guild")
                       End If

                       rank += 1

                       If saReader("logout_time") < saReader("login_time") Then
                           log_status = is_online
                       Else
                           log_status = is_offline
                       End If

                       If char_acc = "Fyben" Then
                           char_acc = "doesnotexist"
                       End If

                       If g = 0 Then
                           returnstring &= "<tr style='background: rgba(26,69,76,0.4); text-align: center; height: 40px; vertical-align: middle'>" & _
                                               "<td style='vertical-align: middle'>" & _
                               "<img src='/img/class-icons/" & char_job_id & ".png' alt='" & char_class & "' /></td>" & _
                                               "<td style='vertical-align: middle'>" & _
                               log_status & " <a href='/profile.aspx?user=" & char_acc & "'>" & char_name_2 & "</a></td>" & _
                                               "<td style='vertical-align: middle'>" & _
                               "[ " & char_guild & " ]</td>" & _
                                           "</tr>"
                           g = 1
                       ElseIf g = 1 Then
                           returnstring &= "<tr style='background: rgba(26,69,76,0.25); text-align: center; height: 40px; vertical-align: middle'>" & _
                                               "<td style='vertical-align: middle'>" & _
                               "<img src='/img/class-icons/" & char_job_id & ".png' alt='" & char_class & "' /></td>" & _
                                               "<td style='vertical-align: middle'>" & _
                               log_status & " <a href='/profile.aspx?user=" & char_acc & "'>" & char_name_2 & "</a></td>" & _
                                               "<td style='vertical-align: middle'>" & _
                               "[ " & char_guild & " ]</td>" & _
                                           "</tr>"
                           g = 0
                       End If
                   End While
               End Using
               saConn.Close()

           End Using

           Return returnstring
       Catch ex As Exception
           Return ex.Message
       End Try
End Function

End Class

CTRL + F for "Password incorrect" on the code , above it you will see that code to Redirect to    Response.Redirect(Request.RawUrl) which means redirect to the domain name if I understood VB.NET right (I'm not a VB.NET developer) .

this code above is basically on "xxxx.com/xxx.aspx" , I want to redirect to a something like xxxx.com/uc/account_control.aspx or xxxxx.com/shop/index.aspx
both those directors exists but I'm not able to do that , and I'm having the following the error :




Sorry but the error is on french , I hope you guys can understand since you are developers since long time . any help is highly appreciated .
This post was last modified: 12-26-2015, 03:07 PM by Imad.

12-27-2015, 01:52 PM #2
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: MasterPage Issue ?
You could just try:
Code:
Server.Transfer("http://xxxx.com/uc/account_control.aspx", true);


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

12-27-2015, 02:57 PM #3
Imad
Junior Member
**
Posts: 4 Threads:3 Joined: Oct 2015 Reputation: 0

RE: MasterPage Issue ?
I have fixed it from the .aspx and not from the code actually by removing ".." as It says on the error code :o Wasn't that hard after all . I'm having another issue right now :

I have basically this :

Code:
<div class='right_content' style='text-align: center;'>
                                <div id="profile_pic" runat="server">
                                    <asp:Image ID="profile_pic_url" runat="server" Height="120" Width="120" />
                                </div>
                            </div>

and the code :

Code:
Private Function grab_p_pic(ByVal username As String) As Boolean
        Try
            Using saConn As New SqlConnection(fyben_reader)
                Dim query As String = "SELECT profile_pic_url FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & SafeSqlLiteral(username) & "'"
                Dim cmd As New SqlCommand(query, saConn)

                saConn.Open()

                Using saReader As SqlDataReader = cmd.ExecuteReader
                    While saReader.Read
                        profile_pic_url.ImageUrl = saReader("profile_pic_url")
                    End While
                End Using
                saConn.Close()
            End Using
        Catch ex As Exception
            submitError(ex.Message)
        End Try
    End Function


On the database , it's not blank , so why the picture shows nothing ? It doesn't make sense .




Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
   TCPListener issue. simx 14 4,925 07-28-2014, 05:31 AM
Last Post: simx
   Thread Issue, Ping Lee Stevens 2 1,633 05-24-2014, 11:59 PM
Last Post: KoBE
  Crystal Report Maximize issue on MDI t0kneneng 0 1,280 09-04-2013, 07:08 PM
Last Post: t0kneneng
   Elevated Program - Drag Drop Issue UIFI AceInfinity 7 5,027 05-06-2013, 05:29 PM
Last Post: AceInfinity
  TCP/IP issue. _HAWK_ 36 9,092 06-16-2011, 06:16 PM
Last Post: HSP


Users browsing this thread: 1 Guest(s)