Results 1 to 6 of 6

Thread: Works on Local but not on web hosting server

  1. #1

    Thread Starter
    Addicted Member DigitalMyth's Avatar
    Join Date
    Nov 2002
    Location
    England..
    Posts
    169

    Exclamation Works on Local but not on web hosting server

    Works on Local machine but not on web hosting server, any ideas why?


    VB Code:
    1. <%@ Page Language="VB" Trace="false" %>
    2. <%@ import Namespace="System.Data.SqlClient" %>
    3. <script runat="server">
    4.    
    5.     Sub Page_Load
    6.     Dim actionstr as String
    7.    
    8.             If User.Identity.ISAuthenticated = "false" then
    9.                 If not Request.QueryString("action") = "login" then
    10.                 Response.Redirect("Corefile.aspx?action=login")
    11.                 end if
    12.             end if
    13.    
    14.     Trace.Write( "User.Identity.ISAuthenticated = " & User.Identity.ISAuthenticated )
    15.    
    16.     End Sub
    17.    
    18.  
    19.  
    20.     Sub Button2_Click(sender As Object, e As EventArgs)
    21.  
    22.     FormsAuthentication.SignOut
    23.     Response.Redirect("Corefile.aspx?action=login")
    24.  
    25.     End Sub
    26.  
    27.    
    28.  
    29.     Function Authenticated(username As String, password As String) As Boolean
    30.             Dim dbconnection As Sqlconnection
    31.             Dim getuserID as Sqlcommand
    32.             Dim userID as SqlDataReader
    33.    
    34.                 dbconnection = New SqlConnection( "Server=888;uid=commline;pwd=88;database=88" )
    35.                 dbconnection.open()
    36.    
    37.                     getuserID = New sqlcommand( "Select u_id FROM Userfile WHERE u_username = '" & Microsoft.Visualbasic.Lcase(txtuser.text) & "' AND u_password = '" & Microsoft.Visualbasic.Lcase(txtpass.text) & "'", dbconnection )
    38.                     userID = getuserID.ExecuteReader()
    39.    
    40.                     If userID.HasRows then
    41.    
    42.                     While userID.Read()
    43.    
    44.             Return True
    45.    
    46.                     End While
    47.    
    48.                     Else
    49.    
    50.                     Return False
    51.    
    52.                     End if
    53.    
    54.                 userID.close()
    55.                 dbconnection.close()
    56.    
    57.     End Function
    58.  
    59.  
    60.  
    61.     Sub Button1_Click(sender As Object, e As EventArgs)
    62.     If Authenticated(txtuser.text,txtpass.text) then
    63.    
    64.     Dim ticket as New FormsAuthenticationTicket( txtuser.text, checkbox1.checked, 10 )
    65.     Dim encTicket As String = FormsAuthentication.Encrypt(ticket)
    66.     Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName,encticket))
    67.     Response.Redirect("Corefile.aspx?action=summary")
    68.     else
    69.    
    70.     Label1.text = "Bad username or Password"
    71.    
    72.     end if
    73.     End Sub
    74.  
    75. </script>
    76. <% Select Case Request.QueryString("action") %><% Case "login" %>
    77. <html>
    78. <head>
    79. </head>
    80. <body>
    81.     <form runat="server">
    82.         <p>
    83.             <font face="Trebuchet MS" size="5"><strong>CLIENT LOGIN</strong></font>
    84.         </p>
    85.         <p>
    86.             <font size="2"><font face="Trebuchet MS">Username:</font>
    87.             <br />
    88.             </font>
    89.             <asp:TextBox id="txtuser" runat="server"></asp:TextBox>
    90.         </p>
    91.         <p>
    92.             <font face="Trebuchet MS" size="2">Password:</font>
    93.             <br />
    94.             <asp:TextBox id="txtpass" runat="server"></asp:TextBox>
    95.         </p>
    96.         <p>
    97.             <asp:CheckBox id="CheckBox1" runat="server" Text="Remember me with Cookies?"></asp:CheckBox>
    98.             <br />
    99.             <br />
    100.             <asp:Label id="Label1" runat="server" font-bold="True" forecolor="Red" font-size="X-Small" font-names="Trebuchet MS" width="227px">Welcome
    101.             to Client Login</asp:Label>
    102.         </p>
    103.         <p>
    104.             <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Login" Width="72px"></asp:Button>
    105.         </p>
    106.         <!-- Insert content here -->
    107.     </form>
    108.     <p>
    109.         <% Case "summary" %>
    110.  
    111.     User.Identity.IsAuthenticated = <% Response.write ( User.Identity.ISAuthenticated ) %> <p>
    112.  <form runat="server">
    113. <asp:Button id="Button2" onclick="Button2_Click" runat="server" Text="Log Out" Width="72px"></asp:Button>
    114.  </form>
    115.  
    116.     <% Case Else %>
    117.  
    118.     What do you want?
    119.  
    120.     <% End Select %>
    121.     </p>
    122. </body>
    123. </html>

    VB Code:
    1. <configuration>
    2.   <system.web>
    3. <customErrors mode="Off"/>
    4.     <appSettings>
    5.  <authentication mode="Forms">
    6.       <forms
    7.         name=".ASPXAUTH"
    8.         loginUrl="corefile.aspx?action=login"
    9.         protection="All"
    10.         timeout="80"
    11.         path="/"/>
    12.       </authentication>
    13. <authorization>
    14. <deny users="?" />
    15. </authorization>
    16.     </system.web>
    17. </configuration>

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    How exactly doesn't it work on the web hosting server? ie. some fucntions don't work, page doesn't load at all.

    Are you given an error message?

  3. #3

    Thread Starter
    Addicted Member DigitalMyth's Avatar
    Join Date
    Nov 2002
    Location
    England..
    Posts
    169
    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

  4. #4
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    Can you put
    PHP Code:
    <customErrors mode="Off"  /> 
    in your web.config file then, and then see what error you get?

  5. #5

    Thread Starter
    Addicted Member DigitalMyth's Avatar
    Join Date
    Nov 2002
    Location
    England..
    Posts
    169
    done, but same error

  6. #6
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    The only time i've had that happen is when there has been a fault on the host.

    Nothing i'm sure about here but a few idea's....
    1. Are both development machine and hosting server running same version of asp.net framework?
    2. Have you uploaded all the correct files to the web server?

    if i think of anything else i'll get back to you,

    Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width