|
Hi all,
When I use the following code in my C# Windows application, it works well.
File.WriteAllText(MapPath(@"softUser_log\log.txt"), "abcd");
But, I want to do the same thing in ASP.NET and I m hosting my files in a remote server "lunarpages" where they use PLESK. Now, When I execute the mentioned code, i dont see that
file has been created and written to it. Do I need to log in PLESK and manually change any permission ? If so, what is the permission should be. I was familiar with Linux and Unix where I used to set permission 777 to a Folder to create or delete file from it, 666 to a file to write on it. But in PLESK, i got very confused, becasuse in Permission area, i saw "user name, IIS domain...etc..etc.... "
Can anyone help me please,.
Thanks and regards
|
|
|
|
|
I'm not clear as to where you code is sitting and where your file needs to be saved. However your URI name is incorrect if you plan to save it to a remote server. You have to make the name: \\server\share\path....\filename to do any kind of save across a network to a server.
If your application is on a server and you are saving the file ON THAT SERVER, then you need to do two things:
1) make certain your folder is created prior to executing your code
2) make certain you have given JUST THAT FOLDER write permissions.
This is from the IIS point of view.
As to PLESK, never heard of it and don't know what you have to do. You may have to get technical support from the lunarpages webmaster instead of us.
|
|
|
|
|
How do we give messagebox autoresponse.
That is message box should not wait for clicking ok button it should be
pop-up and removed.
Rahul Kulkarni
|
|
|
|
|
make your own form. MessageBox needs response from user.
|
|
|
|
|
Create your own form.
In the Form.Load() start a timer.
On the timer.Tick() event, stop the timer, close the form, and return.
|
|
|
|
|
I have use ENTER key to move focus from current control(textbox, combo,etc) to the next control in the tab index list. I get that done, but windows sound a 'ding' everytime i hit enter. The ding does not sound when TAB or UP-DOWN arrows are used.
Ive tried alot of stuff, but i do'nt know why it's sounding, so i ca't
really say for shure where to look.
How can I disable the 'ding' when using the ENTER key?
Andre
|
|
|
|
|
InOut.NET wrote: How can I disable the 'ding' when using the ENTER key?
Check ur Control Panel>>Sound settings.
|
|
|
|
|
programmatclly. I don't want to disable the sound globally, just for the control.
|
|
|
|
|
You need to catch the control's KeyPress event and set the Handled property of the KeyPressEventArgs to true:
private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 13)
e.Handled = true;
}
|
|
|
|
|
|
Hi for all!
I have some problem, while try to read and copy locked or files witch in use.
I try this method, witch work for some file, but the others not
my way:
<br />
FileStream fs = null;<br />
<br />
try<br />
{<br />
try<br />
{<br />
fs = File.OpenRead(file);<br />
}<br />
catch<br />
{<br />
fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);<br />
}<br />
}<br />
catch<br />
{<br />
try<br />
{<br />
string NewFile=File+"_";<br />
Fi.CopyTo(NewFile, true);<br />
}<br />
catch<br />
{<br />
try<br />
{<br />
File.Copy(file, NewFile, true);<br />
}<br />
catch<br />
{<br />
}<br />
}<br />
} <br />
}<br />
catch (Exception e)<br />
{<br />
MessageBox.Show("Grrrrrr: "+e.Message);<br />
}<br />
I miss somethink, or I need a nother way to figure out windows file locking system.
I wait for any ideas....
Thank's for help.
|
|
|
|
|
Try to copy first and then open the new file.
For example :
You have a file "hello.txt". Then you can lock it using
FileStream fStream = new FileStream("hello.txt", FileMode.Open);
If you try to copy it, it works... File.Copy("hello.txt", "hello_1.txt");
Then just open "hello_1.txt".
|
|
|
|
|
Thanks stancrm!
It was the first think I try. But some files it not works. Exampl MS Outlook .pst files can't copy, while Outlook is open.
|
|
|
|
|
I think it is write. It is the reason, why you cannot copy .pst file, if the file is open.
It because of inconsistence reason somehow.
|
|
|
|
|
And is there any method to copy these files?
How about the unlocker programs, how they do it?
|
|
|
|
|
I don't think so...
I've never heard about unlocker program.
|
|
|
|
|
Thaks for your answers!
I hope someone can help me solve this problem.
I think (and hope) is there a comand line util or an assemby program, witch can do anithing with a file, witout the permisson of windows...
PS.:
here you can find some "magic" program , they said, can unlock locked, or in used system or other files...
|
|
|
|
|
Iam developing a SDI windows application where i will have lot of user controls and one form(main) with panel. whenever the user clicks some buttons in form i have to load the corresponding user control into the panel. here i have a need every user control needs access the forms controls like when i click cancel on user control it should remove itself from panel and should load the next user control.
Now currenly i implemented this as the mainform class will create all user control object and pass this(mainform) as a refrence to all usercontrol constructors. so that all user control can access Form's panel to load/unload the usercontrol.
My question : Is design Ok. passing mainform reference to all usercontrols?
or any other way to do it.
Like i have one more idea instead of passing mainform reference every usercontrol will expose one event, mainform should register that event. whenever the usercontrol wants to remove itselft/load another one it has to send the nextusercontrol name as argument event and has to trigger tha event. so the mainform will process the event and unload/load the usercontrol from panel.
From the two apporached i don't which one is correctly. If you guys have some ideas. pleas suggest me.
Thanks and Regards
Srini
|
|
|
|
|
Hi,
both designs are correct and according to some situation one of them will
work better (desing wise i mean). If both work you can choose which one to use.
However, i the first case you should work with an interface instead of passing
the full form to it. This way you can't call any other non usercontrol related
functions from in the usercontrol. This is an better design.
codito ergo sum
|
|
|
|
|
If i understand you correctlly, you acctaully want a MDI-alike interface without the forms.
I've done the same thing (but with MDI forms) and found that a control/form should not unload itself. I prefer a "control marchall" in the main form that cooridnates the creation and disposal of the controls. I use this approach and gives my comlete control over the opened controls. The main form hold the custom control object, and main form can access it when something within the mainform changes and affects the currentlly open controls. The control/form communicates with the mainform using events and mainform cummunicates with the custom control trough public methods. Perfectly 2-way comm bewteen the 2 objects while none is dependant on the other.
engsrini wrote: when i click cancel on user control it should remove itself from panel and should load the next user control.
I use a event that thats fires within the contol when the cancel button is pressed. OnControlRequestClose(object sender).
This event is consumed by the control marchall in the main form and the control marchall then calls the public methods that stop threads running on the control and then safelly control.close();
I your case you can control the next control order from a central entity.
Both your appraches are feasible, but having a marchalling entity makes it so more flexible. The reason i took this road is that my mainform acts as a central management entity that does Audit trails, indicate network comms, log files, handle form malfunctioning and a few more functions that is commonly used troughout my system. I hate copying and pasteing the same code in each form, thus i use the central entity with a combonation of events and custom delegates.
This works fine for me. No refrence of the main form goes to the control. The main form however must 'know' the type of the custom control.
My opinion,
Andre
|
|
|
|
|
Hi,
My requirement is to set combobox column for deptno column of the table dept.
When insert button is clicked,i write the following code
DataGridViewComboBoxColumn cell = new DataGridViewComboBoxColumn();
cell.DataPropertyName = "DEPTNO";
cell.HeaderText = "dno";
cell.Items.Add(10);
cell.Items.Add(20);
cell.DataSource = ds.Tables["dept"];
cell.ValueMember = "DEPTNO";
cell.DisplayMember = "deptno";
dataGridView1.Columns.Add(cell);
dt=new DataTable();
dt = (DataTable)dataGridView1.DataSource;
DataRow dr = dt.NewRow();
dt.Rows.Add();
dataGridView1.DataSource = dt;
My problem is that combobox column is displayed as a separate column.But it value member set to deptno column of dept table.And when i select 30 from that combo box control goes to deptno=30 row.
I want combox cell is set for deptno column and when we select a value from that combo box column the velue is displayed for that row.
How to do this.
Thanks in advance.
|
|
|
|
|
kalkumar wrote: cell.ValueMember = "DEPTNO";
cell.DisplayMember = "deptno";
Display member is the one that's displayed onscreen, the value member represent the underlying value.
Example:
2 colums in table DEPNO (int) and DEPDESC (string).
Valuemember = DEPNO
Displaymember = DEPDESC
this will display the DEPDESC string in the combobox, but when you select a item the combobox returns the DEPNO and not the DEPDESC.
ps:
i get confused witch one is witch. Valuemember may be the one thats displayed and displaymember may be undelying value.
i think this is what you asked
Andre
|
|
|
|
|
Hello folks,
What's the equivalent of BSTR* in .NET (C#)
I used string and it gave me memory error. I used String and nothing gets returned.
The following is the declaration in C++ header file:
extern DllImport short int WINAPI ReceiveResponse(short int, short int, LONG, short int, BSTR*, BSTR*, BSTR*);
extern DllImport short int WINAPI ReceiveData(short int, short int, BSTR*, short int*);
The following is how the two functions declared in VB6 which works perfectly:
Declare Function ReceiveResponse Lib "some.dll" _
(ByVal a As Integer, _
ByVal b As Integer, _
ByVal c As Long, _
ByVal d As Integer, _
ByRef e As String, _
ByRef f As String, _
ByRef g As String _
) As Integer
Declare Function crwReceiveData Lib "some.dll" _
(ByVal a As Integer, _
ByVal b As Integer, _
ByRef c As String, _
ByRef d As Integer _
) As Integer
The following is how I declared it in C# which doesn't work:
[DllImport("some.dll")]
public static extern int ReceiveResponse (
int a, int b, int c, int d,
String e
String f,
String g );
[DllImport("some.dll")]
public static extern int ReceiveData(
int a, int b, String c, int d);
If the way I declare in it C# looks good, I don't know why it didn't work. Perhaps somebody could help me out.
Thanks,
Tony
|
|
|
|
|
try out
[DllImport("some.dll")]
public static extern int ReceiveResponse (
int a, int b, int c, int d,
ref String e
ref String f,
ref String g );
it might help out.
rahul
|
|
|
|
|
DOH!
of course!
Thanks. It works now
-Tony;P
|
|
|
|
|