|
You need to add a code group with a URL or Site membership condition with the necessary privileges (or simply FullTrust permissions) for the directory (or any parent directory) to allow execution from that directory.
For example, using a URL membership condition, use file://MYSERVER/SHARE/* or something like that. Be sure to add the asterisk at the end as a wildcard unless you only want to apply the policy to only one assembly (which, of course, you should include the assembly name).
You should read Understanding .NET Code Access Security[^] here on CodeProject for more information. It's a good read and a comprehensive resource of what you can find scattered throughout the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
I get the same error even if i try to load the assembly from the same directory with the executing assembly.
objH=Activator.CreateInstanceFrom("Test.dll","TestClass");
|
|
|
|
|
Can some1 pls tell me what's wrong with my coding? thank u.
<%@ Page Language="C#" Debug="True" %>
int AddUser(string fname, string sname, string username, string password)
{
string connectionString = "server=\'\'; user id=\'\'; password=\'\'; databas" +
"e=\'\'";
System.Data.IDbConnection dbConnection = new System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "INSERT INTO [Members] ([fname], [sname], [username], [password]) VALUES (@fname, " +
"@sname, @username, @password)";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = dbConnection;
System.Data.IDataParameter dbParam_fname = new System.Data.SqlClient.SqlParameter();
dbParam_fname.ParameterName = "@fname";
dbParam_fname.Value = fname;
dbParam_fname.DbType = System.Data.DbType.String;
dbCommand.Parameters.Add(dbParam_fname);
System.Data.IDataParameter dbParam_sname = new System.Data.SqlClient.SqlParameter();
dbParam_sname.ParameterName = "@sname";
dbParam_sname.Value = sname;
dbParam_sname.DbType = System.Data.DbType.String;
dbCommand.Parameters.Add(dbParam_sname);
System.Data.IDataParameter dbParam_username = new System.Data.SqlClient.SqlParameter();
dbParam_username.ParameterName = "@username";
dbParam_username.Value = username;
dbParam_username.DbType = System.Data.DbType.String;
dbCommand.Parameters.Add(dbParam_username);
System.Data.IDataParameter dbParam_password = new System.Data.SqlClient.SqlParameter();
dbParam_password.ParameterName = "@password";
dbParam_password.Value = password;
dbParam_password.DbType = System.Data.DbType.String;
dbCommand.Parameters.Add(dbParam_password);
int rowsAffected = 0;
dbConnection.Open();
try {
rowsAffected = dbCommand.ExecuteNonQuery();
}
finally {
dbConnection.Close();
}
return rowsAffected;
}
void Button1_Click(object sender, EventArgs e)
{
if AddUser(txtUserName.Text, txtUserPassword.Text) > 0
Message.Text = "Success";
else
Message.Text = "Failure";
}
<asp:label id="Label1" runat="server">User Name
<asp:textbox id="txtUserName" runat="server">
<asp:label id="Label2" runat="server">Password
<asp:textbox id="txtUserPassword" runat="server" textmode="Password">
<asp:label id="Message" runat="server">
<asp:button id="Button1" onclick="Button1_Click" runat="server" text="Register">
|
|
|
|
|
You could try the ASP.NET forum[^]
Also, I don't think people are going to go through all that code looking for your error without an idea of what they are looking for. What error message do you get? What exacly goes wrong?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Hi ,
I want to add a style to the particular row's text in datagrid....as my datagrid is directly take the data from store procedure....
datagrid2.datasource=ds;
datagrid2.databind();
i want to add the style like whenever my mouse is over on that text i want to change the cursor as a hand.
In the css file i created a style for the hand named "hand" ....that's the same i m using in the following code....
datagrid2.Items[i].Cells[1].Style.Add("onmouseover","hand");
plz help me....
Thanks..
|
|
|
|
|
This question really belongs in the ASP.NET forum. It has nothing to do with the C# language itself, even though it's written in C#.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I use PowerPoint 2003 to record the following macro:
<br />
Sub Macro1()<br />
<br />
Presentations.Add WithWindow:=msoTrue<br />
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutText).SlideIndex<br />
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="C:\SAVE\1_files\PSPage1.bmp", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=9, Top:=22, Width:=702, Height:=496).Select<br />
ActiveWindow.View.Paste<br />
With ActiveWindow.Selection.ShapeRange<br />
.IncrementLeft 165.88<br />
.IncrementTop 79.88<br />
End With<br />
End Sub<br />
Now I want to implement it in my C# project,
<br />
ppApp = new PowerPoint.Application();<br />
objPres = ppApp.Presentations.Add(MsoTriState.msoTrue);<br />
objSlide = objPres.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutText);<br />
objShape = objSlide.Shapes.AddPicture:="C:\\SAVE\\1_files\\PSPage1.bmp",MsoTriState.msoFalse,MsoTriState.msoTrue,9,22,702,496);<br />
I can add a slide and insert the Picture,
but I don't know how to do
ActiveWindow.View.Paste
to paste the object I write into clipboard,
Can anyone tell me how to do this in C#...??
Thanks a lot !!
|
|
|
|
|
Anything you can do in VB6 (and older) you can do in a managed languages that supports COM interoperability (just about all of them, including C# and VB.NET). It's all based on OLE/COM automation described in a typelib that you can create an interop assembly from. This interop assembly is also known as a Runtime Callable Wrapper (RCW), which marshals calls from managed to unmanaged.
Unfortunately, though, it's not always as clear what to do as it is with VB (pre-.NET) because not all the type information is reserved. Properties and parameters start being the most basic class: object .
The primary interop assemblies (PIA - typically assemblies created by the developers of the corresponding typelib, and registered in a way that when you reference that typelib the PIA is used automatically instead of a new one being generated) for Office 2003 declare a DocumentWindow.View property, of type View . View.Paste is defined, so you would use:
ppApp.ActiveWindow.View.Paste();
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi there,
It's fairly easy to create a System.Drawing.Color with any RGB value one wishes. It's also easy to get this color HSB values by using System.Drawing.Color.GetBrightness , System.Drawing.Color.GetHue and System.Drawing.Color.GetSaturation member methods.
But can anyone help me create a color from Hue, Saturation and Brightness (HSB) values?
|
|
|
|
|
|
|
Hi ,
I want to add a style to the paricular row's text in datagrid....as my datagrid is directly take the data from store procedure....
datagrid2.datasource=ds;
datagrid2.databind();
i want to add the style like whenever my mouse is over on that text i want to change the cursor as a hand.
In the css file i created a style for the hand named "hand" ....that's the same i m using in the following code....
datagrid2.Items[i].Cells[1].Style.Add("onmouseover","hand");
plz help me....
Thanks..
|
|
|
|
|
Hi,
This box is not enough if I will discuss to you all about datagrid. I suggest you visit the following site and you will find all the solutions and code that you want.
http://aspnet.4guysfromrolla.com/articles/042402-1.aspx
http://wwww.datagridgirl.com
Q1. datagrid2.Items[i].Cells[1].Style.Add("onmouseover","hand");
A1. Try to go to this page "MOUSEOVER coloring and CLick Datagrid"
http://aspalliance.com/articleViewer.aspx?aId=30&pId=1
I hope this will help you.
Good Luck
/Dabuskol
|
|
|
|
|
how do i move AxPdfLib.AxPdf on the form ?
it dosent know mousehandlers.
|
|
|
|
|
As I mentioned with one of your earlier questions, an ActiveX control contains it's own message queue and .NET has no control over that. If there are events exposed on the ActiveX control, those should be declared by the RCW (Runtime Callable Wrapper) and you can use those. If it doesn't have them, there's really nothing you can do. This is not a .NET Control, merely an ActiveX control hosted within a .NET Control that does little more than marshal calls from managed to unmanaged code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanks
please help more.how can i access to RCW .and please a tell me address of related sample .
|
|
|
|
|
The very use of the Acrobat control means that you are already using the RCW. What I was saying was that the ActiveX control has to expose some interfaces that let you handle notification messages. The AxHost control merely hosts the ActiveX control. Messages passed through the message pump are not handled by the window procedure (WndProc ) for the control in the same manner that other controls' messages are handled.
For instance, if you host the WebBrowser control you can modify the AxHost -derived slightly and pass a number of interfaces to the WebBrowser control. I haven't ever needed to try this with the Acrobat ActiveX control (it would be different interfaces, if any) so I don't know if it support this. I do know that it does support ActiveX Containers, but that is beyond the scope of a simple message board.
I recommend you go to Adobe's web site[^] and look for developer information, or search the 'net with google or something. For more information on ActiveX containers, see the MSDN Library Online[^]. It's not a simple solution.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how i serialize userControl BackGroundimage?
i wanted import windows media but i cant rigthclick and doubleclick it.
i want doubleclick in AxmediaPlayer and then open another form that select opened file.
thus i create a usercontrol and hide Axmediaplayer and then size of usercontrol put in size of windows media and show AxmediaPLayer.
now i want serialize and deserializ AxmediaPlayer but I dont Know
what i do?
thanks
|
|
|
|
|
I just answered your question before: you don't need to serialize the media player control at all. You're not sending it across context boundaries (separate AppDomains, separate processes, separate machines, etc.), so there's no reason to serialize it in order to marshal it. Either re-parent the control or use the existing methods from the PlayerApplication class I mentioned before.
You won't be able to recieve single- and double-click events from the AxMediaPlayer control as you would with other Windows Forms control because the AxMediaPlayer control is an ActiveX control with it's own thread queue (message dispatch). If the control exposes appropriate events, you can handle those, but the Click and DoubleClick events you find on other controls will not work.
See my previous post for details about re-parenting the control or using the supplied methods exposed by its typelib that you use to create an interop assembly, which I also gave you instructions on. If you don't understand them, continue the thread - don't start a new one.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanks for your help
i want a form with some controls for example textbox,picturebox,shape,Axmediaplayer,and Axshockwaveflash
and i want to save as that form with total controls,with xml format, and load that form too.
|
|
|
|
|
That's a different request than from before. In the future, please be as descriptive as you can when describing a problem - in anything you do (not just development; like to doctors, lawyers, etc.).
Images can't be serialized using XML Serialization, unless you were to attribute your non-supported properties with your own implementation of TypeConverter s that could effectively convert to and from strings (like for an image, you could serialize as a base64-encoded string using the ToBase64Transform class, for example). That's really about the only thing you can do; either that, or go to a lot more trouble of using Runtime Serialization with a SOAP (an XML dialect) formatter since all your control classes are themselves serializable (which means you have to extend every control you use and implement ISerializable .
I recommend you take a look at Marc Clifton's articles here on CodeProject about his project (recognized by Microsoft), http://www.myxaml.com[^]. It already does a lot of this, and you can either learn from his code (which requires pretty in-depth knowledge of the .NET Framework) or simply use it for your UIs.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi,
is there any command in ADO.NET to list all tables from a given database name?
(in C#)
|
|
|
|
|
ADO.NET is ADO.NET whether you're using C#, VB.NET, MC++, etc. In fact, all assemblies work the same in any managed language. It's important to understand that.
That being said, ADO.NET is an abstract interface to any database driver that uses either an OLE DB driver, ODBC driver, or has implemented a specific driver client implementing the ADO.NET interfaces. That does not mean, however, that every feature in a particular database is supported, since abstraction leads to simplification (which is why SQL Server, Oracle, and others have implemented their own clients for ADO.NET).
Enumerating databases in a DBMS is different; so, what type of DBMS do you want to enumerate?
In SQL Server, you can use the "sp_helpdb" stored procedure. For Access, there is no way other than searching your hard drive for *.mdb, since Access uses Jet Databases, which is a file-based database. It's different for MySQL, Oracle, and others, too.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
in mysql, i can use 'show tables' command to list down all the tables in particular database.
i wanna know how to do this in sql server 2000.
so that i can use C# to perform such operation using data adapter
|
|
|
|
|