+ Rispondi al Thread
Visualizzazione dei risultati da 1 a 8 su 8

Discussione: [ASP]errore:Object reference not set to an instance of an object.

  1. #1
    perla0279 non è in linea Scolaretto
    Post
    230

    [ASP]errore:Object reference not set to an instance of an object.

    ciao

    quando cerco di eseguire una store procedure che va a copiare i dati in un database mi appare questo errore:

    codice:
     Object reference not set to an instance of an object. 
    
                                 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
                  Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
    
                 Source Error: 
    
                                                                            An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.                                                               
                 Stack Trace: 
    
                                                                           [NullReferenceException: Object reference not set to an instance of an object.]
       Artistic.it.galleria800.Unnamed1_Click(Object sender, EventArgs e) +104
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
                                                                  
                               Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
    non riesco a capire il perche???

  2. #2
    perla0279 non è in linea Scolaretto
    Post
    230
    per l'errore di prima ho cancellato e ricreato la store procedure, non sò per quale motivo non la volesse vedere

    adesso mi viene fuori questo però:
    codice:
     Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 
    
                                 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
                  Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
    
                 Source Error: 
    
                                                                            The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
    
    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
    
       <%@ Page Language="C#" Debug="true" %>
    
    or:
    
    2) Add the following section to the configuration file of your application:
    
    <configuration>
        <system.web>
            <compilation debug="true"/>
        </system.web>
    </configuration>
    
    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
    
    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.                                                               
                 Stack Trace: 
    
                                                                           [HttpException (0x80004005): Unable to validate data.]
       System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +294
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +203
    
    [ViewStateException: Invalid viewstate. 
    	Client IP: 84.222.90.66
    	Port: 4445
    	User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
    	ViewState: /wEPDwUJMTA0NTI0NjkyD2QWAmYPZBYCAgMPZBYCAgEPPCsACQIADxYGHg1OZXZlckV4cGFuZGVkZB4MU2VsZWN0ZWROb2RlZB4JTGFzdEluZGV4AgNkCBQrAAIFAzA6MBQrAAIWBB4EVGV4dAUETUVOVR4IRXhwYW5kZWRnFCsAAwUHMDowLDA6MRQrAAIWDh4LTmF2aWdhdGVVcmwFGWluc2VyaW1lbnRvLWdhbGxlcmlhLmFzcHgeBlRhcmdldAUFX3NlbGYeCEltYWdlVXJsZR8DBRRJTlNFUklNRU5UTyBHQUxMRVJJQR4FVmFsdWUFAzMxMx4HVG9vbFRpcAUDMzEzHwRoZBQrAAIWDh8FZR8GBQVfc2VsZh8HZR8DBRFHRVNUSU9ORSBHQUxMRVJJQR8IBQMzMzAfCQUDMzMwHwRoZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFD2N0bDAwJFRyZWVWaWV3MYlH9AbblWNU2sPVQpSHZedvMEvL
    	Referer: http://www.artistic.it/admin/galleria800.aspx?id=Autentificato
    	Path: /admin/galleria800.aspx]
    
    [HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
       System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +267
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +282
       System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
       System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
       System.Web.UI.HiddenFieldPageStatePersister.Load() +198
       System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
       System.Web.UI.Page.LoadAllState() +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
       System.Web.UI.Page.ProcessRequest() +86
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
       System.Web.UI.Page.ProcessRequest(HttpContext context) +49
       ASP.admin_galleria800_aspx.ProcessRequest(HttpContext context) +29
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
                                                                  
                               Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

    cacchio...........ma perchè in locale funziona tutto mentre sul senver non va mai niente!!!!

  3. #3
    L'avatar di SignIn
    SignIn non è in linea Scribacchino
    Luogo
    Milano
    Post
    1,026
    Quote Originariamente inviato da perla0279 Visualizza il messaggio
    cacchio...........ma perchè in locale funziona tutto mentre sul senver non va mai niente!!!!
    ...per il semplice fatto che il tuo pc che fa da web server e client presenta una "configurazione" distante anni luce da quella che invece in genere si ha nei server di chi fornisce hosting...i server in questione possono essere in load balancing, cluster, situazioni sui permessi diversissime e tantissimo altro....ritornando all'errore...nel caso specifico credo che sia necessario indicare la chiave di cifratura del campo viewstate in modo esplicito(nel web.config), a tal proposito qui trovi i dettagli per farlo:
    machineKey Element (ASP.NET Settings Schema)

  4. #4
    perla0279 non è in linea Scolaretto
    Post
    230
    ok corretto quell'errore............adesso ne ho un altro

    codice:
    Server Error in '/' Application.
    Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    
    Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
    
    Source Error:
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    
    Stack Trace:
    
    [InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.]
       System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) +1799842
       System.Windows.Forms.MessageBox.Show(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) +26
       Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title) +544
       Artistic.it.galleria800.inserimento(String RiferimentoPagina) in D:\Siti web\Lavori-siti-web\artistic\Visual-studio\Artistic.it\Artistic.it\admin\galleria800.aspx.vb:208
       Artistic.it.galleria800.Button1_Click(Object sender, EventArgs e) in D:\Siti web\Lavori-siti-web\artistic\Visual-studio\Artistic.it\Artistic.it\admin\galleria800.aspx.vb:215
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
    
    
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

  5. #5
    L'avatar di SignIn
    SignIn non è in linea Scribacchino
    Luogo
    Milano
    Post
    1,026
    Quote Originariamente inviato da perla0279 Visualizza il messaggio
    ok corretto quell'errore
    ..cosa hai fatto(tanto per lasciare qualcosa ai posteri)...
    ...per quest altro errore, qui trovi il perchè non si devono usare le messagebox:
    [ASP.Net]MessageBox & MsgBox
    ...altra cosa poi come hai risolto:
    http://forum.masterdrive.it/asp-3-0-...ina-web-25064/
    (sempre per i posteri e se vuoi)

  6. #6
    perla0279 non è in linea Scolaretto
    Post
    230
    ciao

    per risolvere il problema ho aggiunto una voce al web config che mi ero accorta dii aver involontariamente commentato:



    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>

    cambiato questo sembra essersi sistemato tutto.

  7. #7
    perla0279 non è in linea Scolaretto
    Post
    230
    Volevo chiedervi un'altra cosa................
    se non posso usare in msgbox....per fare aprire una finestra di dialogo simile cosa devo usare???

  8. #8
    L'avatar di SignIn
    SignIn non è in linea Scribacchino
    Luogo
    Milano
    Post
    1,026
    Quote Originariamente inviato da perla0279 Visualizza il messaggio
    ....
    cambiato questo sembra essersi sistemato tutto.
    ....strano.... ma meglio così
    se non posso usare in msgbox....per fare aprire una finestra di dialogo simile cosa devo usare
    ...javascript con una semplice funzione che richiami window.open

+ Rispondi al Thread

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi