Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

.Net Membership via WebApi

$
0
0

I had a system where I authenticate the users via .net Membership.
However now we are developing an iOS application which should call a .Net Webapi and this webapi authenticate the user under .net membership in one another project.

How could I do that ?


How to process all files in folder

$
0
0

I am new to visual studio/ Managed C++. I don't know even in which category MSDN or Managed C++ comes in. I hope i have selected right options from 'forum category' and 'Forum'

My Question is - I want to select and process all images present in folder, if user selects a 'checkbox' named "All". 
Name of images may or may not be same.

Till now, Got file path by => System String^ imgPath = objFileDialog->FileName;
&  folder path by => System String^ folderPath = System::IO::Path::GetDirectoryName(imgPath); 

Please help me.


Websocket traffic via proxy (Reassemble the frame)

$
0
0

Hi All,

I have been created the proxy to trace websocket traffic .It work fine when small amount data has been transferred.

In other case when transfer big amount of the data I received data in difference frame (chunk) instead of one.I need the big data as single frame (chunk) or is there any way reassemble the all the frame.

The below website has been use for the trace websocket traffic.

http://www.websocket.org/echo.html

Best,

how to convert PDF to image file in vb.net

$
0
0
plz how to convert PDF to image file in vb.net i need to convert a pdf file using vb.net

Read the contents of '.SER' files in a folder and save it in xml

$
0
0
Hi,

I am having a requirement which states to Read the contents of '.ser' files present in a folder and save each filenames and file contents of files in that folder to an xml file.
I tried with the below code but getting Runtime.Serialization Exception --> {"The input stream is not a valid binary format. The starting contents (in bytes) are: AC-ED-00-05-73-72-00-10-6A-61-76-61-2E-75-74-69-6C ..."}. Please someone help me out to complete the stated requirement.

Getting exception @ this line string content = (string)bf.Deserialize(fileStream);


XmlWriterxmlWriter = XmlWriter.Create("C:\\TestFile.ser");
// Opens the document
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement(
"SerializedFiles");
foreach (string file inDirectory.EnumerateFiles(serializedFilesFolder,"*.SER"))
{
FileStream fileStream = newFileStream(file,FileMode.Open,FileAccess.Read);
BinaryFormatter bf = newBinaryFormatter();
string content = (string)bf.Deserialize(fileStream);
//BinaryFormatter bf = new BinaryFormatter();
//ArrayList a = (ArrayList)bf.Deserialize(fileStream);
fileStream.Close();
xmlWriter.WriteStartElement(
"SerializedFile");
xmlWriter.WriteElementString(
"FileName",Path.GetFileName(file));
xmlWriter.WriteElementString(
"Content", content);
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();


I did some search for "Reading the '.ser' file in C#", but i found only the java related examples. Please let me know the correct way or some sample code to achieve the requirement.
Thanks in advance.

Regards,
Chetan.

Chetan Rajakumar

Dynamic assembly missing

$
0
0

Hello!

I'm using CSharpCodeProvider to create a class with several fields dynamically. That's the code:

//определение пространства имен
CodeCompileUnit compileUnit = new CodeCompileUnit();CodeNamespace dynNS = new CodeNamespace("Dyn");compileUnit.Namespaces.Add( dynNS );
//определение класса
CodeTypeDeclaration dynClass = new CodeTypeDeclaration("DynClass");
int i = 0;foreach(string gr in Groupings){	dynClass.Members.Add(new CodeMemberField((Type)GroupTypes[i], (string)Groupings[i]));
}
dynNS.Types.Add(dynClass);
//компиляция полученной сборки
CSharpCodeProvider provider = new CSharpCodeProvider();CompilerParameters parameters = new CompilerParameters();parameters.GenerateInMemory = true;CompilerResults cr = provider.CompileAssemblyFromDom(parameters, compileUnit);
//получение типа из сборки
Assembly dynAssembly = cr.CompiledAssembly;
Type dClass = dynAssembly.GetType("DynClass");
Console.WriteLine(parameters);
But I receive an error message like "Unable to load file or assembly". What's wrong?

Undocumented exception observed from write operation on NamedPipeServerStream

$
0
0

Hi all,

When writing on to a NamedPipeServer, it's a blocking call and so till a complete read happen's it doesn't get unblocked.

We tried to read a part of data from the stream and tried disposing/closing the NamedPipeServer. This has resulted in OperationCanceledException which is not documented in MSDN for this operation.

Effectively it should have raised IO Exception.

Can someone help me out with this issue.

IMessage, IMethodMessage, IMethodCallMessage Interface Inheritance Structure

$
0
0

Three .NET Interface namely IMessage, IMethodMessage and IMethodCallMessage, but the interface relation between them are little confusing. IMethodMessage Interface is Inherited from IMessage Interface and then IMehtodCallMessage Interface are Inherited from the two Interfaces they are IMessage and IMethodMessage. My Question is that What is the need to Inherit IMessage to IMethodCallMessage because IMethodMessage already inherited from IMessage.

IMethodMessage : IMessage

             and

IMethodCallMessage : IMessage, IMethodMessage


Background Intelligent Transfer Service (BITS) jobs with different priority.

$
0
0

I have one module which can be called to download files using BITS APIs. Here it take three input as local path, remote URL and value for BG_JOB_PRIORITY.

In one scenario where I call download module via two different call with different BG_JOB_PRIORITY. 1st one has to download 1GB file with priority BG_JOB_PRIORITY_LOW and another call (when 1st job is active in transferring mode) to download module to download 2GB file with priority BG_JOB_PRIORITY_FOREGROUND.

I verified msdn link http://msdn.microsoft.com/en-us/library/aa362805%28v=vs.85%29.aspx which says that "Lower priority jobs do not receive transfer time until all higher priority jobs are transferred or in an error state.", so based on this 2nd job should be finished first to download 2GB file but this doesn't happens.

Based on my custom logs (in call back interface function JobModification), it seems that transfer time is sliced between these two jobs and lower size file downloaded first.

Please let me know if anyone has/had similar kind of experience and solution. How to complete high priority job first irrespective to size of file associated with it?

Thanks in advance.

ASP.NET not automatically creating control instances getting object refrence not set to an instance of an object error

$
0
0

Hi,

ASP.NET Runtime is unable to create control instances am getting following error:

"object reference not set to an instance of an object error"

Its unable to create each an every control on designer. If I manually create instance for one control I start getting error for next control.

The same piece of code was working fine earlier.

I performed following steps before it started throwing error:

1. I removed one HTML Input control on designer but it didn't got removed from designer.vb file, so I manually removed the same. Code was working fine.

2. Next I again added the HTML INPUT control on designer by adding an html for it. Respective declaration for it was added in designer.vb file, I didn't modified the designer.vb. But, this time it started throwing "object reference not set to an instance of an object error" for control added from designer window.

Let me know, how do I get rid of this error?


Sachin R. Chavan.

Hooking WH_CALLWNDPROC for Word application

$
0
0

Dear All,
I am trying to implement a hook filtration function for the WH_CALLWNDPROC in order to intercept messages before they reach a word application.

My code is presented below:
   
    Imports System.Runtime.InteropServices

    ''Constants Definition''
    Private Const WH_CALLWNDPROC As Integer = 4
    Private Const HC_ACTION As Integer = 0
    Private Const WM_DESTROY As Integer = &H2
    Private Const WM_ACTIVATEAPP As Integer = &H1C
    Private IsHooked As Boolean
    ''DLL Definition
    <DllImport("user32.dll")> _
    Private Shared Function SetWindowsHookEx(idHook As Integer, callback As MyWndProcDel, hInstance As IntPtr, threadId As UInteger) As IntPtr
    End Function
    
    <DllImport("user32.dll")> _
    Private Shared Function UnhookWindowsHookEx(hInstance As IntPtr) As Boolean
    End Function

    <DllImport("user32.dll")> _
    Private Shared Function CallNextHookEx(idHook As IntPtr, nCode As Integer, wParam As Integer, lParam As IntPtr) As IntPtr
    End Function

    <DllImport("kernel32.dll")> _
    Private Shared Function GetCurrentThreadId() As IntPtr
    End Function
    
    <DllImport("user32.dll", SetLastError:=True)> _
    Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, _
                          ByRef lpdwProcessId As Integer) As Integer
    End Function
        Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)> _
    Public Structure CWPSTRUCT
        Public lParam As IntPtr
        Public wParam As IntPtr
        Public message As Integer
        Public hWnd As IntPtr
    End Structure

    Private fltrFunc As MyWndProcDel = AddressOf myWndProc
    Private Shared lpPrevWndProc As IntPtr = IntPtr.Zero
    Private Delegate Function MyWndProcDel(nCode As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr

    Public Sub SetWndProcHook()
         Dim PID As Integer
         Dim WordWND  as Long
         If IsHooked Then
             MsgBox("Already Hooked")
         Else
             WordWND = FindWindow(vbNullString, "Document1")
             lpPrevWndProc = SetWindowsHookEx(WH_CALLWNDPROC, fltrFunc, Nothing,    GetWindowThreadProcessId(WordWND, PID))
            IsHooked = True
        End If
    End Sub


    Public Function myWndProc(ByVal ucode As Long, ByVal wParam As IntPtr, lParam As IntPtr) As IntPtr

        If ucode >= 0 Then
            Dim cwp As CWPSTRUCT = DirectCast(Marshal.PtrToStructure(lParam, GetType(CWPSTRUCT)), CWPSTRUCT)
   
            Select Case cwp.message
                Case WM_ACTIVATEAPP
                    cwp.message = 0
                    MsgBox(cwp.message)
            End Select

        Else
            CallNextHookEx(lpPrevWndProc, ucode, wParam, lParam)
        End If
      End Function
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
              SetWndProcHook()
    End Sub
    Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            If IsHooked Then
            UnhookWindowsHookEx(lpPrevWndProc)
            End If
    End Sub




My problem is the following :
        lpPrevWndProc = SetWindowsHookEx(WH_CALLWNDPROC, fltrFunc, Nothing,    GetWindowThreadProcessId(WordWND, PID))
returns 0, which means that function has executed unsuccessfully.
GetWindowThreadProcessId(WordWND, PID)) is returning the Process ID of the opened Word application. The returned value is correct (I have checked it using Spy++ utility).
If I replace the GetWindowThreadProcessId(WordWND, PID)) by GetCurrentThreadId() I am able to hook the WH_CALLWNDPROC of the windows form I am working on. (In this case, the SetWindowsHookEx returns the handle of the hook filtration function.(Which indicates a successful execution)

Any help is appreciated

how web site administration tool

$
0
0
how can I get access to web site administration tool in vs 2013

IO.File.Exists(“”) on Novell Win 7 client can cause a “network error” after file being tested is deleted from a different client.

$
0
0

I asked this question on Stack Overflow and I thought I would post it here also. I will include the link and the post. Someone got me thinking and I tried the win api and it does not have the issue. So there is something about IO.File.Exist and Novell Win7 client. 

Link to Stack Overflow

First the bottom line...
If you use a loop on a Novell client Win7 containing IO.File.Exist(FileTest) looking for FileTest to disappear meaning it is time to move on, delete FileTest from another client, and you then you try to use the name FileTest represents, you will get a network error. The reason I think it has to do with Novell Client Win7, is if the share is a windows share, I do not see the problem. Also, when our clients were XP SP3 (not sure the Novell version) we did not see this. As mentioned in the comment, I tried this on a SAMBA share and did not see the issue.

Next the detail.... 
It is simple to reproduce

    Module Module1
        Sub Main()
            Dim FileTest As String = "\\corp01\vol1\bbs\test.flg" 'corp01 is a Novell share'
            IO.File.WriteAllText(FileTest, "")
            Do While IO.File.Exists(FileTest)
                System.Threading.Thread.Sleep(100)
            Loop
        End Sub
    End Module

Then from another client delete test.flg and the program ends as expected. Try running it again and when it tries to create it in the WriteAllText you will get the network error. It does not seem to matter who or how the file is created. I have tried to rem out the WriteAllText and create it from a different client, then start the program, delete it from the other client and still get the network error when trying to reference the name.

My Guess ....
I think the name is cached somehow. The only way to fix it is log off from windows. Another reason, if the WriteFileText is throwing the error and I try a different way of creating it, still have the error. For example in explorer I create a text file on the share, works ok. Then try to rename the created file to my flag name, network error. I can rename it to any other file name except for the name I use as the flag file.

Decoding the encoded string is not getting the special characters correctly

$
0
0

Hi,

I am using the below code to encode the content of *.ser file

foreach(string file inDirectory.EnumerateFiles("","*.SER")){byte[] content =File.ReadAllBytes( file ); xmlWriter.WriteStartElement("SerializedFile"); xmlWriter.WriteElementString("FileName",Path.GetFileName(file)); xmlWriter.WriteElementString("Content",System.Convert.ToBase64String( content )); xmlWriter.WriteEndElement();}

Now i have to decode the encoded content and create *.ser file, i tried with below code but the size of original *.ser file and generated *.ser file after i decode differs and if i check the content i can see some difference with the special characters.

encodedContent = xmlnode[i].ChildNodes.Item(1).InnerText;
                byte[] data = Convert.FromBase64String(encodedContent);
                string decodedContent = Encoding.UTF8.GetString(data);

Please help me out to solve this issue. Thanks in advance.

Regards,

Chetan.


Chetan Rajakumar

Type.GetTypeFromProgID not returning System.MarshalByRefObject

$
0
0

Hi Folks

I built a prototype which does the following:

1. Is a console application (for demo purposes only)

2. Was intended to show how an SSRS .Net v3.5 assembly could call a v4.5.1 SSO application to return: a.) Database Connection string b.) Report Image Library url

This works great as a standalone console application.

I've take the same "basics" of this console application and wrapped it into a dll (an SSRS Data Processing Extension).

The PROBLEM is, is that the console application instantiates as a System.MarshalByRefObject and external calls to the DLL only get instantiated as System.Object.

Here's the code:

                Type myClassAdapterType = Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter");
                Object myClassAdapterInstance = Activator.CreateInstance(myClassAdapterType);
                Net35ToNet4xAdapter.IMyClassAdapter myClassAdapter = (Net35ToNet4xAdapter.IMyClassAdapter)myClassAdapterInstance;
                string ret = myClassAdapter.DoNet4xAction(blahblahblah);

Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter"); works differently in the console application because everything is "in the application" (and needs not be registered)

The external call to the DLL (which is registered) only shows myClassAdapterType as being from System.Object. Here's a comparison:

CONSOLE APPLICATIONWORKS

Registered DLL CALLED EXTERNALLYFAILS

 

?Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter")

{Name = "__ComObject" FullName = "System.__ComObject"}

   [System.RuntimeType]: {Name = "__ComObject" FullName = "System.__ComObject"}

   base: {Name = "__ComObject" FullName = "System.__ComObject"}

   Assembly: {mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}

   AssemblyQualifiedName: "System.__ComObject, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

   Attributes: Public

   BaseType: {Name = "MarshalByRefObject" FullName = "System.MarshalByRefObject"}

   ContainsGenericParameters: false

   DeclaringMethod: 'Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter").DeclaringMethod' threw an exception of type 'System.InvalidOperationException'

   DeclaringType: null

   FullName: "System.__ComObject"

   GenericParameterAttributes: 'Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter").GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'

   GenericParameter 'Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter").GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'

   GUID: {4b5ad204-13fc-4c9f-9dc4-f0a6ec775d4f}

   HasElementType: false

   HasProxyAttribute: false

   IsAbstract: false

   IsAnsiClass: true

   IsArray: false

   IsAutoClass: false

   IsAutoLayout: true

   IsByRef: false

   IsClass: true

   IsCOMObject: true

   IsContextful: false

   IsEnum: false

   IsExplicitLayout: false

   IsGenericParameter: false

   IsGenericType: false

   IsGenericTypeDefinition: false

   IsImport: false

   IsInterface: false

   IsLayoutSequential: false

   IsMarshalByRef: true

   IsNested: false

   IsNestedAssembly: false

   IsNestedFamANDAssem: false

   IsNestedFamily: false

   IsNestedFamORAssem: false

   IsNestedPrivate: false

   IsNestedPublic: false

   IsNotPublic: false

   IsPointer: false

   IsPrimitive: false

   IsPublic: true

   IsSealed: false

   IsSerializable: false

   IsSpecialName: false

   IsSzArray: false

   IsUnicodeClass: false

   IsValueType: false

   IsVisible: false

   MemberType: TypeInfo

   Module: {CommonLanguageRuntimeLibrary}

   Namespace: "System"

   ReflectedType: null

   StructLayoutAttribute: {System.Runtime.InteropServices.StructLayoutAttribute}

   TypeHandle: {System.RuntimeTypeHandle}

   TypeInitializer: null

   UnderlyingSystemType: {Name = "__ComObject" FullName = "System.__ComObject"}

?Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter")

{Name = "MyClassAdapter" FullName = "Net35ToNet4xAdapter.MyClassAdapter"}

   [System.RuntimeType]: {Name = "MyClassAdapter" FullName = "Net35ToNet4xAdapter.MyClassAdapter"}

   base: {Name = "MyClassAdapter" FullName = "Net35ToNet4xAdapter.MyClassAdapter"}

   Assembly: {Net35ToNet4xAdapter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=09abb560dc6eacfe}

   AssemblyQualifiedName: "Net35ToNet4xAdapter.MyClassAdapter, Net35ToNet4xAdapter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=09abb560dc6eacfe"

   Attributes: Public | Serializable | BeforeFieldInit

   BaseType: {Name = "Object" FullName = "System.Object"}

   ContainsGenericParameters: false

   DeclaringMethod: 'Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter").DeclaringMethod' threw an exception of type 'System.InvalidOperationException'

   DeclaringType: null

   FullName: "Net35ToNet4xAdapter.MyClassAdapter"

   GenericParameterAttributes: 'Type.GetTypeFromProgID("Net35ToNet4xAdapter.MyClassAdapter").GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'

   GenericParameterNet35ToNet4xAdapter.MyClassAdapter").GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'

   GenericTypeArguments: {System.Type[0]}

   GUID: {a6574755-925a-4e41-a01b-b6a0eef72df0}

   HasElementType: false

   IsAbstract: false

   IsAnsiClass: true

   IsArray: false

   IsAutoClass: false

   IsAutoLayout: true

   IsByRef: false

   IsClass: true

   IsCOMObject: false

   IsConstructedGenericType: false

   IsContextful: false

   IsEnum: false

   IsExplicitLayout: false

   IsGenericParameter: false

   IsGenericType: false

   IsGenericTypeDefinition: false

   IsImport: false

   IsInterface: false

   IsLayoutSequential: false

   IsMarshalByRef: false

   IsNested: false

   IsNestedAssembly: false

   IsNestedFamANDAssem: false

   IsNestedFamily: false

   IsNestedFamORAssem: false

   IsNestedPrivate: false

   IsNestedPublic: false

   IsNotPublic: false

   IsPointer: false

   IsPrimitive: false

   IsPublic: true

   IsSealed: false

   IsSecurityCritical: true

   IsSecuritySafeCritical: false

   IsSecurityTransparent: false

   IsSerializable: true

   IsSpecialName: false

   IsUnicodeClass: false

   IsValueType: false

   IsVisible: true

   MemberType: TypeInfo

   Module: {Net35ToNet4xAdapter.dll}

   Namespace: "Net35ToNet4xAdapter"

   ReflectedType: null

   StructLayoutAttribute: {System.Runtime.InteropServices.StructLayoutAttribute}

   TypeHandle: {System.RuntimeTypeHandle}

   TypeInitializer: null

   UnderlyingSystemType: {Name = "MyClassAdapter" FullName = "Net35ToNet4xAdapter.MyClassAdapter"}

 

 

 

 

 

If anyone can help I'd appreciate it. I have a MS support call placed but I'm going no where with this.

Thanks

Rob



Rob K


Is SerialPort ever going to get fixed?

$
0
0

I have had long running issues with System.IO.Ports.SerialPort, as to many other people online. My issue is as follows:
We frequently use USB to Serial adapters as very few PCs nowadays have serial ports. As long as the adapter remains connected, everything works fine.
The minute you unplug the adapter, all ____ breaks loose - the application uses maximum CPU and there is a massive increase in memory usage. It's VERY easy
to reproduce - just get any Proflic based USB to serial adapter (VERY common) and plug it in. Create a simple app and add the following:

class Program
{
static void Main(string[] args)
{
SerialPort port = new SerialPort();
port.PortName = "COM3";
port.Open();
Console.ReadKey();
}
}


Run the app, and after connection, unplug the USB. Thats it - it's just opening the port, nothing special. This needs to get fixed desperatley as it's really punishing developers who want to integrate serial based hardware. It's not even restriced to the Profilic devices. We've seen it occur with the Zensys Z-Wave SDK when using with a USB Z-Wave adapter (which actually creates a serial port).

Please, MS - let us know how to fix this!

 

COM / SERIAL to USB unplugged. Memory leak. System.Threading.OverlappedData

$
0
0

Hello,

Issue description:
1. I am limited with .Net v4.0 . Visual Studio versions I tried 2010, 2012, 2013
2. Platform where my application is running is x64. 
3. I have COM to USB device converter.
4. My test application just opens port and nothing else. I don't even have data received event listener.

As soon as I disconnect COM to USB converter, the amount of memory used by my test application start growing. At least 10 MB per minute. 

Memory dump shows me that I have hundreds of new objects created

Type System.Threading.OverlappedData New objects 246368 New bytes 16753024 Dead bytes 0 Bytes delta 16753024 Type System.IO.Ports.SerialStream+SerialStreamAsyncResult

New objects 246353 New bytes 9854120 Dead bytes 0 Bytes delta 9854120 Type System.Threading._IOCompletionCallback New objects 246352 New bytes 6897856 Dead bytes 0 Bytes delta 6897856

using System;
using System.IO.Ports;
using System.Text;

namespace OpenSerialPortApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var Sp = new SerialPort
            {
                StopBits = StopBits.One,
                BaudRate = 9600,
                DataBits = 8,
                Parity = Parity.None,
                Encoding = Encoding.UTF8,
                PortName = "COM5"
            };

            Console.WriteLine("Port Created");

            Sp.Open();

            Console.WriteLine("Port started");

            //No I just unplug my COM to USB converter.

            Console.ReadKey();
        }
    }
}



How I can deal with this problem ?

I tried to call Close and Dispose on serial port but it makes absolutely no difference.

Thank you for any advise!







.NET document scanning API

$
0
0

Hi,

I am looking for a .NET "scanning API" to scan the documents from .NET application, is there any any good example I can use for this. I want to launch .NET scanning application from another Visual basic application.

Thanks,

Rajeev


Could Generate Excel in Local but Failed when Deployed in Server Can any one give appropiate Solution.

$
0
0

Server Error in '/' Application.

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

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.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

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:
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).]
   System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) +0
   System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) +79
   System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) +76
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.Activator.CreateInstance(Type type) +6
   Oracle_ERP_Assessment_Tool.FormControls.GenerateExcel.btnExportExcel_Click(Object sender, EventArgs e) +401
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446

Convert comma separate string to enums

$
0
0

hi there,

ive got, say the following sample code:

[Flags]
    public enum Types
    {
        Type1 = 1,
        Type2 = 2,
        Type3 = 3,
        Type4 = 4,
        Type5 = 5
    }

and a variable holding the following string:

var stringTypes = "Type2,Type4,Type5";

How can i convert this string into a property/field which returns these 3 string as 3 piped enum values eg.

Types expected = Types.Type2 | Types.Type4 | Types.Type5;

thanks

Viewing all 8156 articles
Browse latest View live


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