|
Hi Friends
I want to write some data to a text file.
How can I know file is already been used by other process ?
Thanking you,
Laxmikant
|
|
|
|
|
How do you mean:
Laxmikant Lad wrote: been used by other process ?
|
|
|
|
|
use Path.GEtTempFile to get a unique filename. The only way I know to know if a file is in use, is to use a try/catch block when trying to access it.
Why are you writing text files on your server ? If you have many users, perhaps a database is a better place for it ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
There is a node A and from this I am trying to access
node B (the web server) with url:
http://172.16.216.187/test/Default.aspx
Now what code shall I write in the Default.aspx.cs at Page_Load (at node B, the web server) such that any program (say notepad.exe) runs on node A.
I tried :
System.Diagnostics.Process.Start("notepad.exe");
But this does not help..
Any solution??
Thanx in advance..
Som
|
|
|
|
|
|
playing with bugs ) wrote: Just redirect the user to the exe of the prgramme i think that will work
Can you elaborate on that with a snippet of code?
Som
|
|
|
|
|
|
playing with bugs ) wrote: Response.Redirect("Relative Path/nameofExe.exe");
I think a window will pop do you want to save or run this exe
As far as my understanding goes, this would prompt me to run/save the exe from the web server..
What I want to do is run an application present in the Clients computer..
Any application will do, but it should run the application from clients system and not save or run the application from the web server..
As I am new to ASP.NET, I read that ASP is a server side programming..
So can we use ASP.NET to run applications on the Client side??
Do I have to inject scripts the server code to do all this??
Som
|
|
|
|
|
You cannot run programs on the client using asp.net. You'll need to code some kind of activeX control or applet to do this. But you should consider what you are doing - a lot of people would not be happy to have their web browser control their pc in this fashion.
|
|
|
|
|
Another person who has no idea what ASP.NET is or does, and is paid to write ASP.NET code. I weep....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Som.Paul wrote: System.Diagnostics.Process.Start("notepad.exe");
Of course not. your C# code runs on the server. You want to run an exe on the client. I'd suggest you're going to have a hell of a time doing that.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sorry for that replies i was thinking out of context
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
The Table1 is a class mapping with in database, and i want to save it in ViewState or Session,
it thrown a error like this
Type 'Table1' in Assembly 'App_Code.bfsthzhd, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
i find property 'Serialization Mode' in *.dbml file. but it seemns does not work at all.
anything help?
Glad to discuss with you and best wishes.
|
|
|
|
|
Hi,
I was using the oledbconnection to connect to my remote hosting server. But the hosting server has upgraded from ms sql 2000 to ms sql 2005. Now I am unable to get connection for my web application thro' ole db,while it is working for sql db connection. How can I get the connection enabled for oledb?
Error message is Connection failed. SQLState '08001' SQL Server Error: 14 [DBNETLIB][ConnectionOpen(Invalid Instance()).Invalid Connection.
Thanks
Jith
|
|
|
|
|
get data from SQL2005 into SQL2000 Server
|
|
|
|
|
What a great post, care to explain more and in a more polite manner
|
|
|
|
|
Can someone tell how can I pass a C# variable value as a parameter in a javascript function please?
because i am still not so confident in scripting
thanks
|
|
|
|
|
Basically, you need to use registerclientscriptblock to create a javascript variable which has the C# value as it's value. As in:
int c = "string";
RegisterClientScriptBlock("cStrig", "var str = '" + c + "'");
Of course you need to emit script tags as well, but that's the overall idea. You need to create a javascript variable that contains the value you want to pass through. The most likely reason to do this is to get the client side id of a control on the client side, where you use code like:
RegisterClientScriptBlock("textbox1", "var textbox1Id = '" + textbox1.ClientID + "'");
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
var foo = '<%= txtFoo.Text %>';
Glad to discuss with you and best wishes.
|
|
|
|
|
I have two Buttons(Edit and Delete) inside UpdatePanel. Edit is worhing properly. When I first click on the Delete button it is not woring. But if I click on it for the second time,it is working. Why?
modified on Thursday, March 27, 2008 3:57 AM
|
|
|
|
|
If I could see your code, I'd try to comment on it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It could be that you need to set the focus on the delete button although like the post above i think you will need to show your code for us to help you further
|
|
|
|
|
Might be you are populating any data sorce which is not again bind again
you need to bind that data again check it or show your code
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
<asp:datalist id="MyDataList" runat="server" datakeyfield="Photoid" onitemcommand="MyDataList_ItemCommand" ondeletecommand="MyDataList_DeleteCommand" repeatcolumns="3" repeatdirection="Horizontal" height="307px" width="547px" bordercolor="Gray" borderstyle="Solid" borderwidth="1px">
<itemtemplate>
<asp:imagebutton id="ImgBtn1" runat="server" width="80px" height="80px" imageurl=""><#databinder.eval(container.dataitem, )%="">'/>
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:label id="title" runat="server" text="">]]>' Font-Names ="Verdana" Font-Size ="8pt" >
<asp:textbox id="TextBox1" runat="server" font-names="Verdana" font-size="8pt" visible="false" text="">]]>' >
<asp:button id="EditBtn" runat="server" text="Edit" font-names="Verdana" font-size="8pt" commandname="Edit">
<asp:button id="Button1" runat="server" text="Delete" font-names="Verdana" font-size="8pt" commandname="Delete">
The above is the aspx page. And in code behind page
protected void MyDataList_ItemCommand(object source, DataListCommandEventArgs e)
{
string id = e.CommandName.ToString ();
if (e.CommandName == "Delete")
{
DBLibrary ob = new DBLibrary();
ob.path1 = Server.MapPath("Database/BlogSiteData.mdb");
string uid = Session["user"].ToString();
string photoid = MyDataList.DataKeys[(int)(e.Item.ItemIndex)].ToString();
System.IO.File.Delete(Server.MapPath("Albums/" + uid + "/" + photoid + ".jpg"));
string sqldel = "Delete from Albums where Userid='"+uid+"' and Photoid=" + int.Parse(photoid) + " ";
ob.ExecuteNonQuery(sqldel);
BuildGrid();
}
}
|
|
|
|
|
try putting a simple bit of code in the command for delete so you can check that is working and then you can go through the exisiting code and see which part of that is causing the problem
|
|
|
|