|
Thanks a lot! I'll try to check with MSDN.
Meanwhile, I made this workaround, tried stopping it from within the debugger (to simulate AppDomainUnload), and it worked OK. I'm not sure how safe it is, but it seems to be working fine.
class MyApp {
private static SafeHandle handle = new MyAppSafeHandle();
public static KeepAlive() { GC.KeepAlive(handle); }
}
class MyLibSafeHandle : SafeHandle {
public MyLibSafeHandle()
: base(IntPtr.Zero, true)
{ MyApp.KeepAlive(); }
protected override ReleaseHandle() {
externRelease(handle);
MyApp.KeepAlive();
}
}
|
|
|
|
|
Hey there!
I'm kinda new to C sharp so if what I'm asking is obvious, then I'm sorry.
I'm trying to use "WebRequest.RequestUri" to get the URI my program is currently crawling, it works fine as i am able to write out the URI to the console, but when i try to save the URI to a variable it goes wrong.
The code:
HttpWebRequest fetchpage = (HttpWebRequest)HttpWebRequest.Create(url);
HttpWebResponse fetchinfo = (HttpWebResponse)fetchpage.GetResponse();
//It is here it goes wrong
string URL = fetchinfo.ResponseUri;
The error: "Cannot implicitly convert type 'System.Uri' to 'string'"
How do i get it to save the URL to a variable?
|
|
|
|
|
string URL = fetchinfo.ResponseUri.ToString(); /ravi
|
|
|
|
|
ResponseUri is type of Uri class so you can't assign it to string. If you need string representation of Uri instance either call ToString() on it or use properties provided by Uri class.
|
|
|
|
|
Just use .ToString()
Good Luck
Prateek
|
|
|
|
|
|
i want to copy a file from a location to some specific location in c#?
|
|
|
|
|
Have you tried
System.IO.File.Copy("Source", "Destination"); Docs on MSDN[^]
Simon
|
|
|
|
|
Simon Stevens wrote: System.IO.File.Copy("Source", "Destination");
Hey I tried it but I got FileNotFoundException. Can u plz e-mail me full project at troll@hotmail.com ? It's very urgntz. Thanks
|
|
|
|
|
|
You should have guessed that it's not he because I said 'Thanks' while he uses[^] 'thx'
|
|
|
|
|
I spotted that. A dead give-away.
7r01z can't write out the word "thanks" without bursting. It's like trolls and sunshine...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Giorgi Dalakishvili wrote: Will it work?
Probably not.
Simon
|
|
|
|
|
thx budy, its working
Maifs
|
|
|
|
|
You need to copy a file so why don't you Google or search msdn? Is it so difficult?
|
|
|
|
|
no, i didnt find it,
thx
Maifs
|
|
|
|
|
|
|
And there is a point to this post? Have you tried MSDN, Google, or even (heaven forbid) press F1 while in the ide?
I think you are in the wrong job if you are unable to do something this simple without posting to a forum.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am facing simlar problem here. If you get it, plz send me also. my email is chandu_reddy86@yahoo.com. Please send
|
|
|
|
|
hi
man read first one ansers to search from googles.this is not a place of doing such questions.
read that articles in my replies then you can find your anser.
thry this one.
System.IO.File.Copy("C:\\abc.txt", "D:\\abc.txt");
and make sure the file is exist on c drive, if not then create a text file
named abc and save on c drive.
Maifs
|
|
|
|
|
Just post your bank account details and I'll email you all the codez you want as urgntz as you can take them. (I'm not joking. I'm serious. Just post them. I won't charge too much )
Alternatively, you can read the responses that are already here and stop wasting everyone's time.
Simon
|
|
|
|
|
Simon Stevens wrote: Alternatively, you can read the responses that are already here and stop wasting everyone's time
or just try a career change
Bob
Ashfield Consultants Ltd
|
|
|
|
|
can any body give me Idea about linq in VS 2008
|
|
|
|