|
Not 100% true. Some obfuscators generate code that Reflector just refuses to work with.
But in general every managed dll can be decompiled to IL easily (reading and understanding IL is another topic ).
|
|
|
|
|
Robert Rohde wrote: Some obfuscators generate code that Reflector just refuses to work with.
That's why those are also to be avoided. If Reflector can't look into the assembly, neither can Reflection, which some classes in the .NET Framework absolutely rely on to work.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
From what I have read, all managed modules contain Metadata which the CLR uses to execute the managed module. It is this Metadata which keeps information about the whole Managed Module. Also , reflection uses this metadata to dig out info about the methods in a managed module or assembly. And the most important part, MetaData is not Optional. It has to be there. So, it is impossible to create an assembly in .NET which reflection cannot access. Because, if reflection cannot access the assembly's metadata, even the CLR will not be able to execute it.
Hope this helps.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Hi
I have a little problem that I need a clue on how to solve.
I have a system which hold a XMLDocument in a application variable. It's a large document, about 10-20 MB in size.
This document needs to be updated about every 5 minutes or so.
When a user request a page on the site, the system test if the XML doc needs to be updated. When it is so, then the request should somehow start the update, but not wait til it finishes, because it will stall the response time for user.
I have tried to create a new Thread, but that terminates when the request ends. So that no good.
I have tried doing response.flush, response.Close, and then update the XML document, but that gets the IE to hang never showing the request.
Please give me a new way to do it And a Merry Christmas to you all :->
Best regars
Brian
|
|
|
|
|
Instead of a single large XML document, why not a bunch of small XML fragments that get recomposed at the client?
From the Churchdown Parish Magazine: "Would the Congregation please note that the bowl at the back of the Church, labelled 'For The Sick,' is for monetary donations only."
|
|
|
|
|
thats not possible, because I get the XML from an extern service, and have no control over how much I can get at a time.
So I need to download the whole document at once.
It is not the clientside the XML goes to. We store it in the application, to generate lots of different pages of that XML.
the XML is a big news feed, which updates every 5 minutes. And we need to reload it, so we can generate new cached pages every 5 minutes.
A page request finds out that the XML doc needs an update, but uses the old one to deliver the page, while starting a an update asynchron, and returns the result asap to the user, without waiting for the XMl loading to finish.
/Brian
|
|
|
|
|
Easy. You don't rely on a page request to kick off the update process. The web site should be concerned with delivering the most recent data possible to the browser, not for checking with another service to see if it's updated.
So, write a Windows Service to get the new data and update the XML file every five minutes. Maintain two copies of the data. One will be the last updated version, "production version", of the XML file that the web site will use. The other will be the "currently being updated" version of the file. Once the update is complete, copy the file to the production version.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave
Thank you for your answer. That sounds like the best solution to me. But again we have a limitation. We only have the posibility to run a web application, because the application it should be possible to move the application just by copying the aspx, dlls, and so to another webserver, and i should run again.
So we need a way to do it within the web application.
Best regards and merry christmas
Brian
|
|
|
|
|
GoodCall wrote: Hi DaveThank you for your answer. That sounds like the best solution to me. But again we have a limitation. We only have the posibility to run a web application, because the application it should be possible to move the application just by copying the aspx, dlls, and so to another webserver, and i should run again.So we need a way to do it within the web application.Best regards and merry christmasBrian
On your ASP.NET application, on the app start, create a timer that ticks every, e.g., 5 minutes, and does whatever you need. This way your page won't "hang" while doing its work.
Just be sure to take care of synchronization to avoid problems when a page request comes and the work is still half-done (e.g., generate a temporary file, and when it's done, rename it to its final name).
I don't see dead pixels anymore...
Yes, even I am blogging now!
|
|
|
|
|
Thanks
I have just read somewhere else, that i can't besure on that the timer is called after the specified milliseconds. Because of its priority to the requests made.
I need to be sure that the XML Doc is loaded every 5 minutes precise, no mather what load the server must be experiencing.
Can I be sure of that?
/Brian
|
|
|
|
|
GoodCall wrote: I need to be sure that the XML Doc is loaded every 5 minutes precise, no mather what load the server must be experiencing.
What is "precise"? Will a few ms make a difference? Often, this warning is made because of multimedia applications, where a few ms would mean skipped frames and/or a poor visual experience. In your case, it seems, you can trust timers, no one would care if a timer is fired with a delay of a few ms.
From the Churchdown Parish Magazine: "Would the Congregation please note that the bowl at the back of the Church, labelled 'For The Sick,' is for monetary donations only."
|
|
|
|
|
Sorry for my English
your right.. a few Ms will not matter at all.
I will try the timer
Thank you very much for your time. I wish you a merry Christmas.
/Brian
|
|
|
|
|
GoodCall wrote: Sorry for my English
Don't worry about it, mine is worse
From the Churchdown Parish Magazine: "Would the Congregation please note that the bowl at the back of the Church, labelled 'For The Sick,' is for monetary donations only."
|
|
|
|
|
I got a web server that has to host both 1.1 and 2.0 webapps. I can run the 2.0 project fine on my local machine which also has 1.1 and 2.0 installed, but when trying to do so on the server i get a parser error message. Its win 2003 server, my local machine is win xp.
What i've tried:
Created a new separate app pool for 2.0 projects.
Going to cmd and /v2.050727 and updated the scriptmap for only the 2.0 webpage (aspnet_regiis.exe) and with certain parameters.
Can anyone help me?
Thanks
/Andreas
The error
---------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'CustomerService.Global'.
Source Error:
Line 1: <%@ Application Inherits="CustomerService.Global" Language="C#" %>
---------------------
Source File: /CustomerService2/global.asax Line: 1
|
|
|
|
|
I solved it.
When right clicking solution and pressing publish website, i had to uncheck "allow this precompiled site to be updateable". Either that or just debug as usual and also upload all the cs-files (which i deleted before since they wasnt used in 1.1).
|
|
|
|
|
I am trying to develop a class or function which takes a process ID, process Name, or a process object (doesn't really matter) and pauses or suspends the process. I know this is possible because my firewall (NVidia) can stop a program's exucution in its tracks, then resume after you allow traffic on the port. Additionally, the ProcessExplorer utility (http://www.sysinternals.com/Utilities/ProcessExplorer.html) provides this functionality.
My application is to pause a legacy instrumentation program which can crash very predictably if certain "conditions" aren't just so... If I could pause or suspend it while doing some housecleaning, I could keep it running fine. I thought this would be a very simple project!!!
At this point, I can enumerate the running processes, gather their IDs and any other relevant info. I tried to enumerate the threads involved in the process, then use the thread class to .sleep or .suspend. However, the type processthread cannot be converted to a system.threading.thread! I have found a C++ project (which I can only partially decipher) here: http://www.codeguru.com/forum/archive/index.php/t-210917.html, which appears to "encapsulate" the process into a debug event for pausing. Perhaps this a way to go, but I dont' know exactly how to use it? I can compile it, run it, and it works, but after the process is resumed, the console app scales to using 100% of the processor. Perhaps if I could make it an assembly I can pass it as a function... Perhaps there are some Windows API functions that would work?
Any help would be appreciated!
Thanks,
TOm
|
|
|
|
|
tboydva wrote: I thought this would be a very simple project!!!
Actually, this will be a very complex project.
What you're doing is actually writing a type of debugger. The only thing you're going to support, though, is breaking the code so it stops running, then resuming it. Just like you do in Visual Studio while debugging your own applications.
You can try to gleen some information from this[^] little project.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave, thanks for the response - I am realizing your first statement is right on the money! Thanks for the URL - I hadn't yet seen that. I'm guessing this debugger is in "regular" basic? I have also found a debugger in managed code (for .NET 2.0) on MSDN. I can understand C# OK, but it takes me some time so I'm trying to see if it has the functionality I'm looking for. It's a bit confusing as the gui is built as an assembly and I haven't figured out how to instantiate it with the proper parameters. Lack of experience in this area is slowing me down (I'm a scientist, not a professional programmer!). I have a colleage who compiled the code I listed above as a function (dll) and I can call it and pause a running process ID. Getting it to resume is still a problem as the function goes out of scope before I pass resume to it. Unfortunatly, I don't know C++ so it's hard to create a class, use it and debug. You can never know enough!!!
Thanks again. Tom
|
|
|
|
|
Hello!
I need to set permissions to keys in the registry... I read something about it in
this site, but I really don't understand how to set permissions...
I would be very thankful if someone could help me...
Thanks in advance!
|
|
|
|
|
The best place to ask would be in the forum at the bottom of the page that the article you read this on. The author would most likely know, or perhaps it has already been anwered there.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I agree, but still, maybe someone knows?
|
|
|
|
|
This can't be this difficult! I created 2 datagridviews where dg1 displays the parent table and dg2 the child table. Selecting and updating records is not a problem. The problem comes when I try to insert records.
I'm using MySQL 4 and Visual Studio 2005. I write in C#. I'm fairly new to C# and the whole .NET "thing" so I don't know if this is the right board but I figured I'd give it a shot.
If I want to insert a new record, I have to insert the parent record first. Update it. Close the app. Re-launch it. And then I can insert my child records in the recently created parent record. Also, only one new parent record at a time. I know this is ridiculous but it's the only way I can insert to the db.
Any ideas?
MySQL db:
Parent table: tbl_parent
id int(10) not null auto_increment,
name varchar(40),
primary key(id)
Child table: tbl_child
id int(10) not null auto_increment,
ref_id int(10),
name varchar(40),
cost float(4,2),
primary key(id),
foreign key(ref_id) references tbl_parent(id)
on update cascade
on delete cascade
As for my C# code:
**Note: this is just one of many messes I've made!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MySql
{
public partial class Form1 : Form
{
//
private OdbcConnection cnn;
private OdbcDataAdapter da0;
private OdbcDataAdapter da1;
private BindingSource bsMaster = new BindingSource();
private BindingSource bsDetails = new BindingSource();
private OdbcCommandBuilder cb0;
private OdbcCommandBuilder cb1;
private DataSet ds = new DataSet();
//
public Form1()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnConnect_Click(object sender, EventArgs e)
{
this.dg1.DataSource = bsMaster;
this.dg2.DataSource = bsDetails;
this.GetData();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
//not sure which one to use
//DataSet changes = new DataSet();
//changes = ds.GetChanges();
//this.da0.Update(changes, "meal");
//this.da1.Update(changes, "details");
//this.ds.AcceptChanges();
//
this.Validate();
this.bsMaster.EndEdit();
this.da0.Update(ds, "meal");
this.da1.Update(ds, "details");
this.ds.AcceptChanges();
}
private void dg1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
}
private void GetData()
{
string user = txtUser.Text;
string pwd = txtPwd.Text;
string cnnString = @"DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=localhost;DATABASE=mydb;" +
"USER=" + user + ";PASSWORD=" + pwd + ";OPTION=3";
if (cnn != null)
cnn.Close();
try
{
this.cnn = new OdbcConnection(cnnString);
this.da0 = new OdbcDataAdapter("select * from tbl_parent order by name", cnn);
this.da1 = new OdbcDataAdapter("select * from tbl_child", cnn);
this.cb0 = new OdbcCommandBuilder(da0);
this.cb1 = new OdbcCommandBuilder(da1);
this.da0.Fill(ds, "main");
this.da1.Fill(ds, "details");
DataRelation rel = ds.Relations.Add("maindetails",
ds.Tables["main"].Columns["id"],
ds.Tables["details"].Columns["ref_id"]);
this.bsMaster.DataSource = ds;
this.bsMaster.DataMember = "main";
this.bsDetails.DataSource = bsMaster;
this.bsDetails.DataMember = "maindetails";
}
catch (OdbcException ex)
{
MessageBox.Show("Error while connecting: " + ex.Message);
}
}
}
}
|
|
|
|
|
Hi,
I'm working on a project that may require us to display a WinForm-based control in an ASP page. I have found examples of how to do so -- Raul Alonzo's article, for example, was very helpful: http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp[^]
I have been able to make this work using VS 2003 and the 1.1 Framework. This project will be done with VS 2005 and the 2.0 Framework, though, so I'm trying to do it there as well. The problem I'm having is that the control simply refuses to display. I do not get an error message or the little control icon, just an empty box.
Here is the Object tag I have in my ASP:
<object id="WFTControl" classid="Bin/WindowsCalendar.dll#WindowsUC.HelloWorld" style="width: 570px; height: 431px">
The HelloWorld control is simply a C# user control with a single button that, when pressed, changes its text to "Hello World".
Has anyone else tried this under 2.0? Is there something different I need to do?
Thanks in advance,
Doug
|
|
|
|
|
hi,
i'm trying to get values of the properties with property info (pi) class. if statement controls the pi.CanRead,
if pi.CanRead then
pi.GetValue(obj, nothing)
end if
(this is just an example)
it's working properly except "FileIOPermissionAttribute.ViewAndModify" and "FileIOPermissionAttribute.All"
it gives error on these two property "The 'get' method is not supported on this property." but it supports...
how can i fix this problem? thanks all..
|
|
|
|
|
Hi,
I don't know (and couldn't find even I searched hard) the ViewAndModify property but the All property if FileIOPermissionAttribute just throws a NotSupportedException in its getter implementation (you can see this using reflector on it).
This is probably because when you set All you implicitely set the values for Append, PathDiscovery, Read and Write to the same value. The All getter would have a problem when those properties would have different values.
|
|
|
|
|