|
Check file access rights
Best regards, Alexey.
|
|
|
|
|
hi i m able to access this file outside .net.....i myself have created tht file....its only not accessing thro .net
Can anyone pls luk into this
Thanks,
Deeps
|
|
|
|
|
ASP.NET code is not run using your user acount (why would it), but a special account. The name of the accound depends on the version of IIS, but it's normally ASPNET or IIS_WPG. You have to grant permission to the file for this account.
---
b { font-weight: normal; }
|
|
|
|
|
Ya Guffa , this makes sense....but how do I grant these permissions to the file...Can u pls help
Thanks,
Deeps
|
|
|
|
|
Open the properties for the file and go to the security tab. If the user account is not listed, add it. Set read permission for the account.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
Thanks all of you for the replies. Thought to post the solution if anyone needs it. Access a remote file through Asp.Net is different from doing it thro a console or win appl as Guffa rightly pointed out. So to do this there is a class WebClient which can be used
Here's the code snippet
WebClient myclient= new WebClient();
Stream st=mycl.OpenRead(@"http://machine-name/filepath");
StreamReader sr=new StreamReader(st)
...
Then startreading the file using the streamReader.
Thanks
Happy Coding
Deeps
Thanks,
Deeps
|
|
|
|
|
That method is fetching the file using the HTTP protocol via IIS, instead of using the file system. That means that the file has to be publicly available (which is not always good), it adds a lot of overhead, and it increases the traffic through IIS.
---
b { font-weight: normal; }
|
|
|
|
|
hi can anyone tell me that when we provide a url and port number in object of TcpClient class what happens. I have defined the url as
string url="127.0.01"
intport=8888;
and then i have passed this way
TcpClient socketfor=new TcpClient(url,port);
can anyone please let me know the meaning of it.
|
|
|
|
|
|
The call will try to establish a Tcp connection to the specified url and port. The url is used to know to which host (computer) the connection should be established. The Url can be a normal adress (like http://www.codeproject.com) or like in your case an ip adress (actually the first one will be resolved to an ip adress on the fly). The ip "127.0.01" is always the local machine - thus the connection will be established to yourself. As every host can have multiple connections open the port number differentiates these connections.
Probably this description is a bit too simple (I'm no real expert on this) but it should give you a rough idea.
|
|
|
|
|
hi all,
i have an app and am wondering the best way to periodically check for updates or other events.
should i use the windows scheduller or just have a thread that sleeps alot? or another way?
which is best practice?
more often than not the period between checks would be once or twice a day. this i think is along time to sleep a thread.
any ideas pls?
kind regards,
g00fy
|
|
|
|
|
Personally I wouldn't use the scheduler. You have more control when doing it yourself.
You could even avoid having your own thread by using a System.Threading.Timer[^] class which manages this internally.
|
|
|
|
|
Hi
Is it possible to have a check box in a listview (windows application) column header and while checking this, all the check boxes in the column will be checked?
|
|
|
|
|
I don't think it is..
You could either drop a small button on to although that would be rubbish.
You could hide the column headers and have the first row of data being a dummy row, when you check its checkbox it checks all the others.
-- modified at 9:16 Friday 21st April, 2006
|
|
|
|
|
i have this column in an excel worksheet that contains hyperlinks to other documents. the rest of the columns contain regular values (e.g. Roger). the whole worksheet iotself would be exported to a datagrid using c#.getting these regular text values to display is fine but the probelm is that i can't get the url behind the hyperlink...
help me please.
thanks.
|
|
|
|
|
How are you fetching the data? If you do it with OleDb you probably won't have any luck. I think you need to use the Interop assemblies for Office.
|
|
|
|
|
Hello,
I have 3 classes for example :
public MainClass
{
private int maximum = 100;
private int minimum = 0;
private int valueC = 50;
[Browsable(true)]
public int Maximum
{
get {return maximum ;}
set {maximum =value;}
}
[Browsable(true)]
public int Minimum
{
get {return minimum ;}
set {minimum =value;}
}
[Browsable(true)]
public int ValueC
{
get {return valueC ;}
set {valueC=value;}
}
public MainClass()
{
}
}
public ElementsClass
{
private PropertiesClass elementsProperties;
[Browsable(true)]
public PropertiesClass ElementsProperties
{
get {return elementsProperties;}
set {elementsProperties =value;}
}
public ElementClass()
{
}
}
public PropertiesClass
{
private bool visible = true;
private Color colorC = Color.Black;
private bool blink = true;
[Browsable(true)]
public bool Visible
{
get {return visible;}
set {visible =value;}
}
[Browsable(true)]
public Color ColorC
{
get {return colorC;}
set {colorC=value;}
}
[Browsable(true)]
public bool Blink
{
get {return blink;}
set {blink=value;}
}
public PropertiesClass()
{
}
}
In the MainClass i want to include a ElementClass property but i must be able to have an ElementClass array or collection and each ElementClass has the 3 PropertiesClass properties.
What i don't know how to do is the next:
I want to show the MainClass properties in a PropertyGrid, the ElementsClass data must open a new window like a collection editor showing a list of all the ElementsClass objects that i have created.
Finally when i select some element in the list, the propertyGrid must show the PropertiesClass properties (visible, colorC, blink).
Can somebody help me with this?
Regards,
Alberto Martinez
|
|
|
|
|
First you could have searched for collection editor[^] here on CodeProject. That gives you several links.
Here[^] and here[^] are two good articles which deal especially with this topic.
|
|
|
|
|
I'm trying to optimize some code that I've written and I've come across a style that I use ~20 or times that will be run ~100 or so times during the full execution of my code(a VSTO excel spreadsheet).
Here's the common syntax
If (complicated boolean statement)
{
form.attribute = true;
}
else
{
form.attribute = false;
}
I was wondering whether using something like this would make any difference
form.attribute = complicated boolean statement.
Could eliminating the if/else actually noticably speed up my code, or is this change so insignificant that I shoul concentrate on some of the other pieces of code to eliminate database calls and recomputation when it isn't necessary?
|
|
|
|
|
You can safely remove the if-else clause, but it won't result in a noticable performance increase.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The difference in performance is so very small that it's more a matter of taste and style.
The second code is a bit more efficient, mainly because it doesn't contain a jump. If you only run the code a hundred times though, the difference in execution time is so small that it's not even possible to measure.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
my problem comes from the fact that I'm trying to make my progressbar progress while I'm scanning directory files.the awk thing is that my scan function is defined within my datalayer as a dll.I want my progress bar to follow the files processing. I first thought about threads but could'nt move on.probably got allergy for threads.can anybody help?
thanks in advance
|
|
|
|
|
If you have "access" to the source of the datalayer dll you could create some events. You can trap these events in your app then, like what the WebBrowser does with it's DocumentProgress (or something like that) event.
Ed
|
|
|
|
|
Your problem seems to be a perfect candidate for the BackgroundWroker thread control that's newly available in the .NET 2.0 framework.
Using this controll is rather pain free. It's literally a matter of a few click to get yourself set up with a background worker thread that is going ot perform the scan in background for you. The way you use this control is you have to provide three functions to handle three events. One is the actual worker function (this will be the function that scans the files). Then There is a function that will be called when the progress changes. And the last one is going to be a function that will be called when the thread ahs finished processing. So in the actual worker function you will need to call the ReportProgress function that will basically marshal your call and eventually fire the second event (the progress changed event) on the appropriate thread. It's that easy.
Feel free to google for the BackgroundWorkerThread samples online
Good luck
Mikk
----
www.muzikstor.com
|
|
|
|
|
Assume I send a ICMP packet that request timestamp, then I receive timestamp reply.
I can see type, code, identifier, sequence, originate time, receive time...
I can get a receive time.
and I Knew that I set a originate time.
how set a originate time value??
DateTime.Now??
DateTime.Now.ToFileTime()??
plz^^ Can you recommend me??^^
Nothing!! But gonzo!!
-- modified at 16:18 Thursday 20th April, 2006
|
|
|
|