|
Hi,
Aseem Sharma wrote: But it could be irritating to so many users.
It would be more irritating if some application ran with more rights than I assigned to it
Aseem Sharma wrote: How can the application be started with full/administrator/escalated rights when it is being launched automatically at windows startup? I need to do this on VISTA and Windows 7.
Proces.Start [^]. Needless to say that you'll need to supply the password of the local administrator before you're allowed to do that.
Good luck
I are Troll
|
|
|
|
|
Ha! I did something like that* on my last job. I wrote a little app to monitor the health of the system -- availability of the databases, status of the many Windows Services, etc. But the users (operators) didn't have the same access as the Services -- so I used a Process to execute various things (always read-only). The username and password for the Services was already stored in a database (mostly out of laziness), so I access that; the user doesn't know the password, doesn't even know that the app executes under a different user.
* But not actually an administrator, just a user with access to more systems.
|
|
|
|
|
You need a manifest file to launch the app with admin permissions, provided the user has them in the first place!
In the application manifest file, there is a line that looks like this:
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
You have to change that line to read:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
|
|
|
|
Hi Dave,
Thanks for your reply. Actually I am new in .Net technologies. I don't know how to create a manifest file. I don't know how to ship it with installer.
My requirement:
My application can allow/revoke the right of changing system time and date to any user but only if it is being run from an administrator user. When I run my app while logged on as an non-admin user, my application cannot allow or disallow any right to any user (this is desired behavior and its working fine). But same thing happens even when I log on as a user with admin rights. The only way my app can allow or revoke rights to any user is first-the current user should have admin rights, second-application run with "Run as administrator" option.
Please help me in below things:
1 How to create a manifest file?
2 Is it sufficient to just place it in the same directory where the application exe is present? (If yes then while installing I would just need to copy it along with the application exe in the same directory)
3 If application starts automatically on Windows startup, what would happen if a non-administrator (restricted user) log on? (would the application run with admin rights or with the rights of logged on user?)
4 Are there some registry entries where if an application exe is specified, it will run (on Windows startup) with all the rights the current user have?
Please help me in this problem.
Best Regards
Aseem
|
|
|
|
|
Aseem Sharma wrote: needs administrator rights to function properly
You'll have to prove that, or redesign. What is it that you are trying to do? Will a Web Service be of any help?
|
|
|
|
|
Hi Piebald,
Thanks for your reply.
My requirement: My application can allow/revoke the right of changing system time and date to any user but only if it is being run from an administrator user. When I run my app while logged on as an non-admin user, my application cannot allow or disallow any right to any user (this is desired behavior and its working fine). But same thing happens even when I log on as a user with admin rights. The only way my app can allow or revoke rights to any user is first-the current user should have admin rights, second-application run with "Run as administrator" option.
If you can suggest me any solution, plz let me know.
Best Regards
Aseem
|
|
|
|
|
I have a sample telnet server. on port 23 that I use to view log files and small things like that. What I don't know is how to check the current connection terminal emulation when I connect to it.
I use MT32 Telnet to connect to it. I just need to detect the terminal emulation on the server.
any one have any ideas or thoughts on this.
Thanks
|
|
|
|
|
Dunno. Maybe ask for an answerback? Try sending an ENQ (ASCII 5) and see what you get back.
|
|
|
|
|
Hi,
I am working with a C# project containing different assemblies. One of the assemblies A is used by other assemblies, added as a reference link. Now we want to load this assembly dynamically at runtime instead and calling its methods. There is no problem loading assembly A dynamically
Assembly assembly = Assembly.LoadFrom(Path.GetFullPath(assemblyName));
I can call methods in assembly A throught
MethodInfo method = Type.GetMethod("MethodXX");
method.Invoke(null, null);
Now to my question. Do I have to call all methods in assembly A with Invoke(...) or can I just create a interface and call methods with
MethodXX(....)?
Regards
Olof
|
|
|
|
|
If you can define an interface that is non-dynamic and part of your EXE (or a non-dynamically linked DLL), and the dynamically loaded assembly holds a type implementing that interface, then yes that is the easy way out to use the dynamic type.
A non-dynamic base class could work well too.
|
|
|
|
|
why you create interface??? you no need tthe redefinition of methods another time ( exist in assembly!!)
you need juste to invoke method from assembly A.
|
|
|
|
|
Hey guys,
I want to the following,
load a specific connection string from app.config change it then re load it in run time.
any suggestions
THX
|
|
|
|
|
|
Hey, thanx for the quick reply, let me clarify what I posted earlier.
I want to retrieve the connectionString I have, make a change to it (change the data source) and load it back in App.config.
ConnectionStringSettings settings =
ConfigurationManager.ConnectionStrings[name];
// If found, return the connection string.
if (settings != null)
returnValue = settings.ConnectionString;
return returnValue;
something like this:
returnValue = // my new connection string
// now load it back and connect to database using the new string in runtime
THX
|
|
|
|
|
That has nothing to do with "connection strings" though.
Read up on using the app.config and Configuration class and the System.Configuration namespace. There is also a newer connection section that Microsoft added. Idea is similar.
Also note that writing back to the App.config, as far as I am concerned, means it is no longer human maintainable. It will remove most formatting and all comments.
|
|
|
|
|
add connection string to app.Config file under <configuration> tag such as
<configuration>
<connectionStrings>
<add providerName="System.Data.SqlClient" name="connStr1" connectionString="Data Source=(local)\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=TRUE"/>
</connectionStrings>
</configuration>
right click on solution explorer second and add reference System.Configuration
string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["connStr1"].ConnectionString;
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connStr);
conn.Open();
|
|
|
|
|
Hi Guys. I have a file with two sequences, Sequence A and a Sequence B. Sequence A only appears once in the file and Sequence B can appear once or multiple times in the file. See Sample data below:
<B{1:F01CODENNNNXXX1234897878}{2:O1011702100608COMCODEXXXXX81287520281006081802N}{4:<br />
:20:TESTINGFILE01<br />
:28D:1/1<br />
:50H:/12345678901<br />
TEST NAME<br />
ADDRESS1<br />
ADDRESS2<br />
ADDRESS3<br />
:30:101022<br />
:21:REFERENCE1<br />
:23E:OTHR/DMST<br />
:32B:ZAR5005,00<br />
:57A:CODEXXXX<br />
:59:/12345600002345678<br />
TEST NAME2<br />
ADDRESS1<br />
ADDRESS2<br />
ADDRESS3<br />
:21:REFERENCE2<br />
:23E:OTHR/DMST<br />
:32B:ZAR7005,00<br />
:57A:CODEAAAA<br />
:59:/12345657002345678<br />
TEST NAME3<br />
ADDRESS1<br />
ADDRESS2<br />
ADDRESS3<br />
:71A:OUR<br />
-}
The portion in Bold is Sequence A and the remainder is sequence B data.
As you can see by the "TAGS" the fields starting with ':', that there are multiple Sequence B data. I need a way to pick up the data for the multiple Sequence B records. Sequence B start with :21: and ends with :59: followed by the address details. I tried a straight forward StreamReader and then populating the data but my Steamreader always goes from top to bottom in my while loop. Sample below.
string inFile;
inFile = textBox1.Text;
StreamReader sr = new StreamReader(inFile);
string holdline;
int lineCount = 0;
int clientname = 0;
int creditname = 0;
while (!sr.EndOfStream)
{
holdline = sr.ReadLine();
if (holdline.Length > 4)
{
string tag = holdline.Substring(0, 4);
string tag2 = holdline.Substring(0, 5);
if (tag == "{1:F")
{
lblBIC1.Text = holdline.Substring(6, 8).Trim();
lblClientBIC.Text = holdline.Substring(46, 8).Trim();
lblMsgType.Text = "MT" + holdline.Substring(33, 3).Trim();
lblDate.Text = holdline.Substring(36, 10).Trim();
lblSWIFTRef.Text = holdline.Substring(58, 10).Trim();
}
if (tag == ":20:")
{
int results = holdline.Length - 4;
lblA20.Text = holdline.Substring(4, results).Trim();
}
else if (tag2 == ":21R:")
{
int r1 = holdline.Length - 5;
lblA20.Text = holdline.Substring(4, r1).Trim();
lblA20.Refresh();
}
else if (tag2 == ":50H:")
{
int r3 = holdline.Length - 6;
lblA50H.Text = holdline.Substring(6, r3).Trim();
lblA50H.Refresh();
clientname = lineCount;
}
If I do things like this I end up overwriting the first Sequence B data with the second sequence B data. How can I capture both Sequence B data? Should I make use of "switch and case" statements instead?
Any advice would be greatly apreciated.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Try adding "+" characters:
lblA20.Text += holdline.Substring(4, results).Trim();
...
lblA20.Text += holdline.Substring(4, r1).Trim();
...
lblA50H.Text += holdline.Substring(6, r3).Trim();
Would be better if you used StringBuilder, but hey ho!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Hi Griff. Not sure if that will work for what I have planned. What I am currently doing is writing the data to labels. Sequence B can be made up of multiple records/lines, each containing a set of TAGS. Tags are anything that start and end with ": ". From the sample I supplied, one sequence B records starts with TAG :21: and ends with TAG :70:
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
If it's not too big, you could read the whole thing in and use a RegularExpression to parse it.
I would likely read it one character at a time rather than as lines. You can then write a little Finite State Machine.
You are also trying to do two things in one method here; I recommend splitting the method in two -- one to read/parse, one to display.
The reader/parse could return a List of Tuples, each Tuple wouyld contain the type/number of the field and the data.
|
|
|
|
|
Kwagga wrote: Any advice would be greatly apreciated.
Write a parser which reads the file and creates a data structure (presuming that the file is reasonably sized.)
Your data struct is represented by the following pseudo code
class RecordA
{
...
}
class RecordB
{
...
}
class Data
{
RecordA RecordA
List<RecordB> RecordBList
}
After you have populated Data above then you pass it to something else.
|
|
|
|
|
I want to create a UI in which user may b able to add table and can edit/update it (just like a table control we have available for development purpose). Can somebody suggest me how to inherit that control of VS so that I can clone full of its functionality? Please remember that I want to do it for a desktop based application.
Regards
saq!b
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
|
Do you mean design and add a new table, or just add resords to an existing table?
If it's the latter, then as suggested, a DataGridView would probably do the trick. If not, you'll have to probably write something yourself or use some sort of DB manager.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
hello everybody,
i am developing a c# project and sqlsrver 2005.
during deployment i used to attach database from installer.
every thing works fine on xp. but on windows 7 it install perfectly but while loging it throws
exception that execute permission denied on object table name user username dbo.
its some time works fine and some use to throw this type of exception.
i search lot on google and dont get any suitable answer.
thanks in advance
|
|
|
|