Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all 1710 articles
Browse latest View live

assembly binding help needed

$
0
0

hiya all,

can someone help me decipher the fusion log to figure out the issue in my solution.

we've upgraded a package version, but now the bindings (almost) always fail

all I can think is:

a) theres' something that is filelocked or failing build and so is not replacing the old dll (clean clean clean... what else?)

b) theres another component in the project that is using an older dll and so clashing...?

c) theres an explicit referenc in the project to (eg an assembluy reference in .config, specifying a different build number...? (can't see any... doesn't mean its not there...)

there is THIS, but I think its right... but perhaps I need to change 6.0.0.0 to 6.0.1304.0 on "old" and "new" Versions...?

<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly>

d) other

so I'm not sure I'm fully understanding the fusion log output, but here it is, I'm sure there must be some clue or hint in here that will help me figure this out...

fuslog output:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.1304.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///D:/dev/currentproject/Main/Source/WebServices/
LOG: Initial PrivatePath = D:\dev\currentproject\Main\Source\WebServices\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\dev\currentproject\Main\Source\WebServices\web.config
LOG: Using host configuration file: \\netcommon\users$\myuser\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.1304.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/454766d8/80d08c69/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/454766d8/80d08c69/Microsoft.Practices.EnterpriseLibrary.Logging/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
LOG: Attempting download of new URL file:///D:/dev/currentproject/Main/Source/WebServices/bin/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.


- UPDATE - that's the "FusionLog" from the VS2013 error "view details"

if I turn on fusionlogging and run without debugging, this is what you get (mostly the same but with more detail...

LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.1304.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/454766d8/80d08c69/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/454766d8/80d08c69/Microsoft.Practices.EnterpriseLibrary.Logging/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
LOG: Attempting download of new URL file:///D:/dev/currentproject/Main/Source/WebServices/bin/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\dev\currentproject\Main\Source\WebServices\bin\Microsoft.Practices.EnterpriseLibrary.Logging.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.


Unsigned assemblies and application running from NAS

$
0
0

I created an in-house utility program that we run from a NAS location. This program loads several unsigned DLLs at runtime (LoadAssembly). The program runs fine most of the time, but from time to time, a user will get a SystemAccessViolation exception (trace shows a call to StrongNameSignatureVerification as the last thing that happened).

I'm not sure exactly what is going on. Multiple users can be running the program. Like I said, the program runs most of the time.

 

.NET Application doesn't start in Debug due to EEFileLoadException at memory location

$
0
0

Operating System 32 bits

Processor x64 based

The application doesn't start on Debug

I tried uninstalling/installing .NET4 several times. The config file is 

<?xml version="1.0"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
</configuration>

The build configuration looks correct.

I have the following error only on Debug build:

First-chance exception at 0x750d9132 in Application.exe: Microsoft C++ exception:EEFileLoadException at memory location ...

Some dlls appear to be missing but actually exist

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.BadImageFormatException
   at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
   at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
   at System.Reflection.Assembly.Load(System.Reflection.AssemblyName)
   at System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly)
   at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType)
   at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType, Int16)
   at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16)
   at System.Windows.Baml2006.Baml2006Reader.Process_ConstructorParameterType()
   at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
   at System.Windows.Baml2006.Baml2006Reader.ReadKeys()
   at System.Windows.ResourceDictionary.SetDeferrableContent(System.Windows.DeferrableContent)
   at System.Windows.Baml2006.WpfSharedBamlSchemaContext+<>c.<Create_BamlProperty_ResourceDictionary_DeferrableContent>b__297_0(System.Object, System.Object)
   at System.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(System.Object, System.Object)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(System.Xaml.XamlMember, System.Object, System.Object)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(System.Object, System.Xaml.XamlMember, System.Object)

Exception Info: System.Windows.Markup.XamlParseException
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
   at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
   at System.Windows.Application.LoadComponent(System.Object, System.Uri)


What is error ioibmurhynrxkw0zxkyrvfn0boyyufow clr20r3?

$
0
0

Program crashes on startup with this strange error:

EventType clr20r3, P1 myapp.exe, P2 1.1.1.1, P3 4d079677, P4 system.configuration, P5 2.0.0.0, P6 4889de74, P7 1a6, P8 136, P9 ioibmurhynrxkw0zxkyrvfn0boyyufow, P10 NIL.

very strange! my application is vb.net 2010 framework 2.0. works on every workstation but sometimes crashes!

sometimes also i'm getting this error:

EventType clr20r3, P1 myapp.exe, P2 1.1.1.1, P3 4bd81b76, P4 acenservice, P5 1.0.0.6, P6 4bd81b76, P7 d, P8 c6, P9 system.invalidoperationexception, P10 NIL.

any ideas?


Isidoros MCTS VB.NET

How Micrisoft Word layouts the contents based on "useprintermetrics" compatibility option?

$
0
0

Hi All,

I am working for converting the Word documents as images using GDI+. I have faced the problem based on the "useprintermetrics" compatibility option. In the Open XML SDK they have given some information about GetDeviceCaps using printer DC. But i dont know how to get the printer DC? Anyone knows the information regarding this. Please share your answers ASAP.

Thanks,

Pradeep L

How to use the Profiling API to record the parameters and returned value?

Can call sites be identified from the perpective of a DynamicObject?

$
0
0
Hi, researching how to simulate protected-member access from an implementation of DynamicObject and wondered if it is possible to verify that the calling MethodBase context would rightfully have access to that member the case of a contained (non-single inheritance) scenario. Is this information only internal to the binder?

Obtaining debug symbol (PDB) files for .NET Framework 4.5.2

$
0
0

Hello,

It seems that Microsoft forgot to publish the debug symbol files for the .NET Framework binaries distributed with the .NET 4.5.2 update.

For example, the following diagnostic message is printed by windbg/symchk when attempting to download the symbols for x64 clr.dll, version 4.0.30319.34209, distributed with the .NET 4.5.2 update (when the update is installed on Windows Server 2008 R2 SP1):

SYMSRV:  http://msdl.microsoft.com/download/symbols/clr.pdb/E3E0C76A7909454FB3C56B0C2CE5FFEB2/clr.pdb not found
DBGHELP: clr - no symbols loaded

As a result, diagnostic tools (such as SOS.dll debugger extension, profilers, etc.) fail to work correctly.

It is already over 50 days since the release - and these CLR builds are starting to pop up in customer installations.
Is there any other way to obtain the PDB files?

Thank you.


Compiler Time Symbols

$
0
0

Does anyone know where I can find a list of compiler time symbols that visual studio already uses, such as: DEBUG, NET_4_0, RELEASE....?

I am asking because I run this code and I am looking to expand it.

private static string DotNetVersion()
{
         string value = "Nothing";
#if NET_4_0
         value = "4.0";
#elif NET_4_5
         value = "4.5";
#elif NET_4_5_1
         value = "4.5.1";
#elif NET_4_6
         value = "4.6";
#elif NET_4_6_1
         value = "4.6.1";
#endif
         return value;
}


MSDN jbeen19

It doesn't support keyword Lock when debugging the clrcore by visual studio

$
0
0

class sample
    {
        static object o = new object();
        static void Main(string[] args)
        {
            lock (o)
            {
;
            }
      }
   }

If we use the lock and debug sample program above by the steps below through VS , it would got the exception stack below, however it exception wouldn't happen if run the sample.exe by the command directly such corerun.exe sample.exe
https://github.com/dotnet/coreclr/blob/master/Documentation/building/debugging-instructions.md

Assert failure(PID 10844 [0x00002a5c], Thread: 23564 [0x5c0c]): (pInlineGetter[0] == 0x65 && pInlineGetter[2] == 0x8B && pInlineGetter[4] == 0x25 && "Initialization failure while stomping instructions for the TLS slot offset: the instruction at the given offset did not match what we expect")

CORECLR! FixupInlineGetters + 0xE5 (0x00007ff9498e8885)
CORECLR! InitJITHelpers1 + 0x1CB (0x00007ff9
498e8aab)
CORECLR! EEStartupHelper + 0xBCD (0x00007ff94963c62d)
CORECLR!
EEStartup'::9'::__Body::Run + 0x53 (0x00007ff949641333)
CORECLR! EEStartup + 0x78 (0x00007ff94963b9c8)
CORECLR! EnsureEEStarted + 0x229 (0x00007ff9
4963cd19)
CORECLR! InitializeEE + 0x3E (0x00007ff94963fbfe)
CORECLR! CorRuntimeHostBase::Start + 0x168 (0x00007ff9
49661428)
CORECLR! CorHost2::Start + 0x1CF (0x00007ff94966120f)
CORERUN! TryRun + 0x780 (0x00007ff6
a2015a60)
    File: c:\users\xxx\coreclr\src\vm\jitinterfacegen.cpp Line: 175
    Image: C:\Users\xxxx\coreclr\bin\Product\Windows_NT.x64.Debug\CoreRun.exe

HeapDump.exe exception when using ForceGC

$
0
0

I'm trying to get familiar with PerfView while testing a chunk of my code for a memory leak.  However when I click on "Force GC" in the "Collecting Memory Data" dialog (or simply run HeapDump.exe from the command line) I get the following exception (shown with the rest of the log messages):

Exec: "C:\Users\jmoore\AppData\Roaming\PerfView\VER.2016-02-16.08.44.44.000\x86\HeapDump.exe" /ForceGC 5064 Loading the ETWClrProfiler. Turning on debug privilege. Highest Runtime in process is version v4.0.30319 0.0s: Trying to attach a profiler. 0.1s: Done Attaching ETLClrProfiler ret = 0 Attached ETWClrProfiler. 0.2s: Enabling JScript Heap Provider 0.2s: Enabling EtwClrProfiler 0.2s: Enabling CLR GC events 0.2s: Requesting a JScript GC 0.2s: Requesting a DotNet GC 0.2s: Requesting .NET Native GC HeapDump Error: System.Runtime.InteropServices.COMException (0x80071068): The GUID passed was not recognized as valid by a WMI data provider. (Exception from HRESULT: 0x80071068) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.CaptureState(Guid providerGuid, UInt64 matchAnyKeywords, Int32 filterType, Object data) at GCHeapDumper.TriggerAllGCs(TraceEventSession session, Stopwatch sw, Int32 processID) at GCHeapDumper.ForceGC(Int32 processID) at Program.MainWorker(String[] args)

Completed: Forcing a GC to process 5064   (Elapsed Time: 0.416 sec)
Error: HeapDump failed with exit code 1.  See log for details.

I'm not sure how to resolve this.

About C# P/invoke a callback function in a c++ struct.

$
0
0

Hi all,

I received an SDK suite from a third party company, so I have no clue how its methods were implemented. All I have got is the documentation from the company. The SDK is written in C++. In this SDK, I encountered an odd callback implementation that is different from the "normal" callback I have seen before.

According to the document, there is a struct 

NET_EHOME_CMS_LISTEN_PARAM,

and it looks like this:

structNET_EHOME_CMS_LISTEN_PARAM
{
  // ip address for some device
  NET_EHOME_IPADDRESS    struAddress;
  // odd callback here!
  DEVICE_REGISTER_CB fnCB;
  void *pUser; //pointer user data
  BYTE byRes[32]; //document indicates set to 0.
}

in C#, I wrapped the struct like this:

[StructLayoutAttribute(LayoutKind.Sequential)]
public struct NET_EHOME_CMS_LISTEN_PARAM
{
  public NET_EHOME_IPADDRESS structAddress;
  public DEVICE_REGISTER_CB fnCB;
  public IntPtr pUser;
  [MarshalAsAttribute(UnmanagedType.ByValArray,
  SizeConst = 32, ArraySubType = UnmanagedType.I1)]
  public byte[] byRes;
}

and also the callback:

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool DEVICE_REGISTER_CB(
  Int32 iUserID,
  UInt32 dwDataType,
  ref NET_EHOME_DEV_REG_INFO pOutBuffer,
  UInt32 dwOutLen,
  ref NET_EHOME_SERVER_INFO pInBuffer,
  UInt32 dwInLen,
  ref IntPtr pUser);


This is how I use the callback function:

lpCMSListenPara.fnCB = new EHomeSDKCS.DEVICE_REGISTER_CB(DeviceRegisterCB);

notice that the lpCMSListenPara is the struct's new object.

The callback did not invoke at all after the struct is taken as the parameter in the method shown below: (according to the document, this is the only parameter "StartListen" method takes)

// Method that uses the struct
iHandle = EHomeSDKCS.NET_ECMS_StartListen(ref lpCMSListenPara);

Is it the correct way to implement a callback in a c++ struct or did I do something wrong? I tried to search a solution to this sort of situation on MSDN but I did not find any precedent, thus the question here.

Thanks a lot,

J.H





OpCodes.Ldc_I4_S Field

clr function take more time when move one server to another

$
0
0

hii,

we have created clr for send notifiction .

In clr we send notifiction on android mobile it's working fine on local and testing server but on production server take  too much time nearly 4 minute'

we restore same .dll and fucntion

streamreader.readtoend taking 4 minutes for getting response from gcm at production server

Help on convert C++/CLI Vs2003 projects into C++/CLI Vs2005

$
0
0

Hello,

We have projects created in VS2003 C++/CLI and Planned to covert them into C++/CLI Vs2005. But after opened Vs2003 into VS2005 and then compiled which produces bunch of syntax and other compiler errors which seems so much work required to resolve them manually.

The  below compiler option selected to compile it:

"Common Language Runtime Support (/clr)" which we wanted it.

And also, found that, the following link has specified a MS convert tool which is no longer available.

http://www.microsoft.com/downloads/details.aspx?familyid=a3581805-1af2-4c34-9d0e-6029cc078441&displaylang=en

Please suggest me, are there any other tools which I can use to convert the projects from C++/CLi Vs2003 to VS2005?

any other additional compiler options to compile the code with minimum code changes?

Any other suggestions on this will be appreciated

Thanks

Obula.




PerfView: unable to see my Classic events

$
0
0

So, first of all, I'm aware that this is not specific to the .NET CLR, but really I'm not sure of a better place to put this since it deals with PerfView and PerfView is closely tied to .NET.

I'm in a situation where we're starting to instrument a system with ETW events for benchmarking, analysis, etc but since we're just at the start we're figuring out the best way to do it. It is a legacy system (ie. all the code is still maintained, but a heap of it could do with a refactor/rewrite/update, which we're slowly attempting to work through), and a current requirement (hopefully for not too much longer though, a couple of years perhaps) is support for Win XP Embedded Standard. Our understanding is that for C/C++ apps, Win XP doesn't support manifested ETW events from user applications, so we're trying to start with a smaller set of Classic events in the most important parts, which hopefully we can start expanding slowly, and convert all the events to manifested after we can drop Win XP support.

Which brings me to the problem: PerfView doesn't seem to see these classic events. What I get is a list of providers which contains the providers (rather event GUID & opcode) that the events were raised with, but when I select them and refresh in PerfView, there appears to be no events present at all. I've also tried viewing it with ETWTraceEventSource from the TraceEvent Nuget package for .NET 4.0 (ie. just outputting basic information for all the loaded events and I get the same lack of event information (expected as I'm given to believe that PerfView is built on top of TraceEvent). I've verified that I'm calling the C/C++ TraceEvent function correctly and that it is returning success.

Also, interestingly enough, my version of Windows Performance Analyzer (version 6.3.9600.16384) cannot see any events inside the ETL file either, but a colleague's version of WPA (version 6.2.9200.16384) *can* see events.

I've tried capturing with PerfView (PerfView and WPA 6.3 failed to see events), and I've tried capturing with logman (PerfView and WPA 6.3 fails, but WPA 6.2 succeeds).

Is PerfView supposed to be able to see Classic/non-manifest events? I thought it was just a generic tool, and it didn't matter where the events came from?

.Net Profiler in Windows 2016 - Error in Profiled Web Application

$
0
0

Hi,

My .Net instrumentation Profiler has a C++ code and a helper assembly which is added in GAC using gacutil.exe. 

It works perfectly well in the OS till 2012 and windows 8.1. But while profiling the same web application in Windows 2016 OS, it throws an error (But the application dint Crash ,i.e . the w3wp.exe dint close).

1. First request after the iisreset throws 

Initial Error after iisreset

2. Then on Giving a refresh (F5) , the error comes as. - Still the w3wp.exe pid is same.

Second error

3. On refreshing the third time the application opens up. 

But without my profiler the application opens up on the first request itself. Injecting on some 'X' function throws the error , i guess. Cant able to finalize the reason for the issue. 

Regards,

./Selva

Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

$
0
0
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.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

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.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace: 

[FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   SocialFare_MVC.MvcApplication.Application_Start() +0

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12949749
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12966756
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12806561

Unable to transfer session data from form to form

$
0
0

User Name Input Form

I am using VS 2012 up5 & C# on Windows 7 Pro OS. I am a novice to ASP.Net and learning how to use session state for web forms. I have two simple forms that I am trying to transfer a user name from textbox input to a blank page using session state data. When I click the button event nothing happens, I don't see the next form with a user name. Here is my code snippets. What am I missing here?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FillSessionName.aspx.cs" Inherits="FillSessionName" EnableSessionState="True" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><div><asp:Label ID="PageText" runat="server"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;<asp:Label ID="Label1" runat="server" Text="User Name:"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>&nbsp;&nbsp;<asp:Button ID="btnsend" runat="server" Text="Send Text Value to Next Page" /></div></form></body></html>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class FillSessionName : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        PageText.Text = "Page Loaded Text Here";
    }
    protected void btnsend_Click(object sender, EventArgs e)
    {
        Session["Username"] = txtUsername.Text;
        Response.Redirect("ShowSessionName.aspx");
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ShowSessionName : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Username"] != null)
        {
            Response.Write(Session["Username"].ToString());
        }
    }
}



.NET Runtime 2.0 Error Event ID: 5000

$
0
0

Description:

EventType clr20r3, P1 abc.exe, P2 1.0.0.0, P3 57551778, P4 system.data, P5 2.0.0.0, P6 4333aea2, P7 2334, P8 0, P9 system.typeinitialization, P10 NIL. 

Anyone can help? thanks so much.

Viewing all 1710 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>