|
OK - Furthermore, it was not the correct master page, sorry about that.
I've added the AJAX tool kit .dll, edited the web.config and the the correct default.master files, then resetted IIS, built and deployed my solution.
Now, I get an error when I do a postback from my webpart. In addition, even if I modify and deploy the solution, nothing happens, the webpart seems to be blocked...
Thanks for your help
modified on Sunday, August 1, 2010 6:54 PM
|
|
|
|
|
|
Indeed, with a Timer it's working but during a post back, I get a javascript error:
"Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are..."
That why I tryed to follow your trick: http://msdn.microsoft.com/en-us/library/ff650218.aspx[^]
For that, I downloaded the following http://www.microsoft.com/downloads/details.aspx?FamilyId=91f3c22c-8be7-4721-9449-84f699337d55&displaylang=en[^]
Then deployed the solution containing the AjaxSupport.dll into my server and add the reference into my web part project.
Then, I added the following within my default.master file
<%@ Register
Assembly="Microsoft.Practices.SPG.AJAXSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8768CCAE1C3C9EB2"
TagPrefix="spg"
Namespace="Microsoft.Practices.SPG.AJAXSupport.Controls" %>
<spg:SafeScriptManager ID="SafeScriptManager"
runat="server"
EnableUpdatePanelSupport = "True"
/>
Then, in my web.config, I added a safecontrol tag and resetted IIS:
<SafeControl Assembly="Microsoft.Practices.SPG.AJAXSupport, version=1.0.0.0, Culture=neutral, PublicKeyToken=87###########", Namespace="Microsoft.Practices.SPG.AJAXSupport", typeName="*", Safe="True" />
Now, I'm getting an error by uploading my default.master file:
"The Control type 'Microsoft.Practixes.SPG.AJAXSupport.Controls.SafeScriptManager' is not allowed on this page. The type is not registeres as safe".
Need some help, please.
Thanks
modified on Tuesday, August 3, 2010 5:52 AM
|
|
|
|
|
I've found! The problem didn't come from the environment but from my code.
I tried to set visible a textbox which didn't exist yet.
Thanks for your help.
|
|
|
|
|
Hi,
I have a DataTable that is being generated during runtime with values from the memeory. Now my question is,is there a way you can run a sql query against the data in the datatable so that it can return data in a specifik format?
In my datatable there is for example three columns called A,B,C and I want to do someting to retrieve that data with the column names Name,Surname,Age instead of A,B,C for example. Like giving an alias to the column names when retrieving the data from the datatable.
Any Help is greatly appreciated.
|
|
|
|
|
You should be able to use DataTable.Select()[^] to query your DataTable.
As for your column names, give them whatever name you like when you create your DataTable, see here[^]
|
|
|
|
|
I have a desktop based application. Now I want that when my application installed then only administrator the system can have access to the event viewer.Apart from admin, other users cannot access the 'eventvwr.msc' file.
I know the manual method that how to restrict the access to the event viewer.
Task : Enable Event Viewer Permissions
Enabling event viewer user permissions restricts access to the event viewer log files. Once these permissions are set, only administrators will have access to the event viewer logs.
1. Browse to the c:/windows/system32 directory
2. Locate the file eventvwr.msc
3. Right click on the file and select properties
4. From the properties window select the security tab
5. Highlight and remove all entries except the administrators group/user
6. Click apply and ok.
Vinay Khanna
|
|
|
|
|
public class FilePermission
{
CreateLogFiles logfile = new CreateLogFiles();
/// <summary>
/// usernames list will store all the system user's name
/// </summary>
List<string> usernames = new List<string>();
/// <summary>
/// adminusers list will store all the admin user's name
/// </summary>
List<string> adminusers = new List<string>();
/// <summary>
/// event viewer file name with path
/// </summary>
string file_path1 = Environment.SystemDirectory + "\\eventvwr.msc";
string file_path2 = Environment.SystemDirectory + "\\en-US\\eventvwr.msc";
/// <summary>
/// FileList on which filepermission applied
/// </summary>
List<string> FileList = new List<string>();
public FilePermission()
{
try
{
if (File.Exists(file_path1))
{
FileList.Add(file_path1);
}
if (File.Exists(file_path1))
{
FileList.Add(file_path2);
}
// -- here first of all get the ownership of event viewer file.
// ownership is given to the current user
getOwnership(FileList);
// -- get the all users list and load into generic list usernames
GetALLUsersList();
// -- get the admin users list
Load_Admin_Users();
}
catch (Exception ex)
{
logfile.ErrorLog(Program.LogFile, ex.Message);
//MessageBox.Show(ex.ToString());
}
foreach (string file in FileList)
{
RemoveAccess(file);//Remove all the access one by one
}
}
/// <summary>
/// get the ownership of the specified file
/// </summary>
private void getOwnership(List<string> filenames)
{
try
{
foreach (string file in filenames)
{
ExecuteCommandSync("TAKEOWN /F " + file);
}
}
catch (Exception ex)
{
logfile.ErrorLog(Program.LogFile, ex.Message);
}
//ExecuteCommand exe = new ExecuteCommand();
//exe.ExecuteCommandSync("TAKEOWN /F " + file);
}
/// <summary>
/// get the all users list
/// </summary>
private void GetALLUsersList()
{
DirectoryEntry directoryEntry = new DirectoryEntry("WinNT://" + Environment.MachineName);
foreach (DirectoryEntry child in directoryEntry.Children)
{
if (child.SchemaClassName == "User")
{
usernames.Add(child.Name);
}
}
}
/// <summary>
/// get the admin user list
/// </summary>
private void Load_Admin_Users()
{
using (DirectoryEntry groupEntry = new DirectoryEntry("WinNT://./Administrators,group"))
{
foreach (object member in (IEnumerable)groupEntry.Invoke("Members"))
{
using (DirectoryEntry memberEntry = new DirectoryEntry(member))
{
adminusers.Add(memberEntry.Name);
//Console.WriteLine(memberEntry.Name);
}
}
}
//Console.ReadKey();
}
/// <summary>
/// set the access permission to the specified file
/// </summary>
/// <param name="FilePath"></param>
private void RemoveAccess(string FilePath)
{
try
{
FileSecurity fs = File.GetAccessControl(FilePath);
foreach (string uname in usernames)
{
// if the user have not admin rights then remove all file rights from him
if (adminusers.Contains(uname) == false)
{
try
{
fs.AddAccessRule(new FileSystemAccessRule(System.Environment.UserDomainName + "\\" + uname, FileSystemRights.FullControl, AccessControlType.Deny));
File.SetAccessControl(FilePath, fs);
}
catch (System.Security.SecurityException se)
{
logfile.ErrorLog(Program.LogFile, se.Message);
}
catch (Exception ex)
{
logfile.ErrorLog(Program.LogFile, ex.Message);
}
}
}
}
catch (Exception ex)
{
logfile.ErrorLog(Program.LogFile, ex.Message);
}
MessageBox.Show("Admininstor only permissions applied on event viewer file!", "AppliedSecurityPermission");
// @System.Environment.UserDomainName\AccountName denied from FullControl access.");
}
/// <summary>
/// Executes a shell command synchronously.
/// </summary>
/// <param name="command">string command</param>
/// <returns>string, as output of the command.</returns>
public void ExecuteCommandSync(object command)
{
try
{
// create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters.
// Incidentally, /c tells cmd that we want it to execute the command that follows, and then exit.
System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
// The following commands are needed to redirect the standard output.
//This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
// Do not create the black window.
procStartInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
// Get the output into a string
string result = proc.StandardOutput.ReadToEnd();
// Display the command output.
Console.WriteLine(result);
}
catch (Exception objException)
{
// Log the exception
logfile.ErrorLog(Program.LogFile, objException.Message);
}
}
}
|
|
|
|
|
hello
I need to provide facility for Matlab to do bulk insert to SQL. Matlab provides ways to load .NET assembly and call .NET methods:
Assembly reference: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/net.addassembly.html
Method calls: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brpb58s-1.html#brpca5n-1
However, we can't pass "Cell Array":
Example:
<br />
% 2 Dimensional array of numbers<br />
a=[1 2 3; 3 4 5; 6 7 8]<br />
aa=[1.1 2.2 3.3; 4.4 5.5 6.6; 7.7 8.8 9.9]<br />
% Single dimension string array (2D not permitted)<br />
b={'aaa0'; 'bbb0'; 'ccc0'}<br />
bb={'aaa0','aaa1'; 'bbb0', 'bbb1'; 'ccc0', 'ccc1'}<br />
<br />
c={'20100701' 1.11 2.22; '20100702' 3.33 4.44; '20100703' 5.55 6.66;}<br />
<br />
"c" above is cellarray
Now, my only option is to wrap bulk insert logic in ATL COM server, and call from Matlab as such:
dbServer = actxserver('MyDBComServer');
The first article below shows how to build a simple ATL server in C++ but:
PROBLEM 1: sample shows only passing simple type such as string/BSTR - I need to pass a Matlab CellArray across (For this problem... I don't have much clue how CellArray is represented in memory as thereby passed across Matlab/COM/.NET borders)
PROBLEM 2: I don't have access to .NET System.Data.SqlClient.SqlBulkCopy (For this problem can I packaged ATL done by C#? From Visual Studio 2008 \ New Project, I can find "ATL Projects" only under VC++. Is my option a COM server without ATL as indicated in Third Reference below? I am inheriting an old VB.NET COM project but having problem getting it registered, but it must be possible)
PROBLEM 3: Windows 2003 64 bit - any deadend you know?
http://digital-clipart.de/KB/COM/SimpleCOM.aspx[^]
1..2..3 ways of integrating MATLAB with the .NET[^]
http://msdn.microsoft.com/en-us/library/aa645712(v=VS.71).aspx[^]
dev
|
|
|
|
|
Good Morning all,
Currently I try to accomplish to load a DLL (filename and path) as an assembly to be available to all classes in my project.
This is because one of our third party classes makes a call to an unreferenced dll and therefore fails.
I already tried different things:
- loading the assembly into the AppDomain.CurrentDomain
- instanciating objects of the required type via reflection
- I tried different locations for doing the above mentioned things (Startproject, directly before the error occurs, etc)
All solutions loaded the assemblies, but the type seems inaccessible to the third party class.
In VisualStudio 2010 in the output window I can see the line saying that the dll is loaded.
Funny (yeah, not really funny, quire obvious) is that when I copy the dll into the executing directory or reference it via the Project References everything works fine. Unfortunately this is not a solution, because we use MEF to import such classes (third party) into our Application.
I thought about copying the dll to the application folder because thanks to MEF I can get a handle on every DLL necessary... but that would be quite ugly, wouldn't it?
I guess I just forget about something...but it doesn't pop into my mind..
Any help is kindly appreciated,
best regards
Andy
|
|
|
|
|
From what I understand, using add-ins, plug-ins, etc. only works with code that is designed to work that way.
What's "MEF"?
|
|
|
|
|
Sorry, I don't get it...
MEF means "Managed Extensibility Framework", you can export and import certain types (thats a really low level description) to extend "things".
best regards
Andy
|
|
|
|
|
In my experience, you can't just plug-in a class that wasn't designed to be plugged-in. Generally, you create an interface that describes the plug-in. A class that is intended to be used as a plug-in implements the interface. Your application loads the class' assembly and uses it via the interface. The interface has to be declared separately from the plug-in.
Does the class implement an interface or base class that you can use? What sorts of things are you trying to do with the class?
|
|
|
|
|
Actually that is exactly what I am trying to do.
The Third-Party-Tool (ref. TPT) requires an Interface to interact with.
Now I use MEF to import all available classes that explicitly export this Interface and store them in a catalogue (Assembly-Catalogue).
So far so good, everything works fine as long as I stick to the current assembly to build the catalogue from.
Now I've added other dll's that expose (export) the above mentioned Interface. The path of this dll is stored in a XML file in order to retrieve them later and add the found dlls to the Cataloge (its now a mix of the Assembly and the added dll's).
Now I can populate additional "actions"... till here, everything is fine.
The TPT stores the name of the dll (when an action is selected) and when it tries to "grab" it again later (when the action is executed) it tries to resolve the dll, which fails.
Here is the point where I have already overwritten (extended) the methods for Object-Retrival used in the TPT.
That's the story so far
|
|
|
|
|
hoernchenmeister wrote: that is exactly what I am trying to do
OK, good.
hoernchenmeister wrote: Now I can populate additional "actions"...
I'm unclear on what you mean by that. Do you mean load other plug-ins?
hoernchenmeister wrote: The TPT stores the name of the dll
But there could be multiple suitable classes in one dll/assembly; how can that work?
hoernchenmeister wrote: which fails
Do you get an Exception?
|
|
|
|
|
PIEBALDconsult wrote:
OK, good.
Indeed
PIEBALDconsult wrote: I'm unclear on what you mean by that. Do you mean load other plug-ins?
Yes, that is right. What I was referring to as "action" is a class that implements the IAction Interface (the interface required by the TPT).
So I basically load all classes providing the IAction interface into, lets say an admin interface where users can select the type of action they want to execute.
That's the part that actually works
The TPT then takes the "selected and configured action" and stores it.
The TPT requires an action of type IAction for beeing able to do so.
Even that works, actions are created from the XML catalogue and stored.
But when the action is finally executed the TPT tries to build a valid object from the storage (IAction). It uses the fullname and it's own Object-Builder (which I have already extended) to build the action-object and fires it.
Here I get the exception which is that the referenced assembly can not be found...
That only works when referencing the DLL from the xml-catalogue or copying it into the bin directory of the current project.
|
|
|
|
|
Then I don't know.
hoernchenmeister wrote: which I have already extended
Maybe start there. Undo what you did and see what happens.
|
|
|
|
|
That's ok, but anyway, thank you for thinking about this.
I'll give it a rest, sometimes problem become more "solvable" if a day or two pass by
|
|
|
|
|
"... makes a call to an unreferenced dll and therefore fails":
Have you tried loading that "unreferenced dll" before, or putting that dll to the GAC?
|
|
|
|
|
Yes, I did that.
I know the path of the dll and created instances via Activator.
In the meantime I figured out that the third party tool uses incompatible object-detection. I tried to overwrite that plugging in a different Type-Loader, but somehow it's not letting me tweak the base which seems to cause the problem.
Due to the fact that when I reference the dll in the VS2010 project itself everything works, I thought about creating a reference in code, based on the path of the missing dll at runtime.
Would that be possible?
...just pretending it was referenced...
Maybe before the tool makes its first call to the dll... I hope I could express myself clearly (sorry, not a native speaker)
Unfortunately GAC isn't an option due to structural matters.
|
|
|
|
|
Hello,
Please I want to get the upperbound of a dynamic array,
is there a function in c# to achive this?
thanks.
|
|
|
|
|
Dynamic Array[^]
Sathesh.
Blessed is the season which engages the whole world in a conspiracy of love.
|
|
|
|
|
You can find how many elements are in an array with the Length property.
C# doesn't have dynamic arrays - they are all fixed when you declare them, but you can fake it by creating a new array and copying the old elements to it. This is not a dynamic array however, as only the references you specifically change have the new size.
int[] orig = new int[] { 1, 2, 3, 4, 5, 6 };
int[] copy = orig;
int[] temp = new int[10];
for (int i = 0; i < copy.Length; i++)
{
temp[i] = copy[i];
}
copy = temp;
"copy" now refers to an array of ints with ten elements, but "orig" tsill referes to an array of six.
If you want a dynamic array like structure, you would be better off using a List<T> which has a ToArray method if you need it.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
OriginalGriff wrote: If you want a dynamic array like structure, you would be better off using a List<t>
Or switch to VB?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
riced wrote: Or switch to VB?
Wash your keyboard out with soap!
I would never recommend anyone switch to VB.
Well, except Estate Agents.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|