|
You have to close the request stream also.
MSDN on GetRequestStream:
CAUTION You must call the Stream.Close method to close the stream and release the connection for reuse. Failure to close the stream will cause your application to run out of connections.
---
b { font-weight: normal; }
|
|
|
|
|
Hi Tariq,
I'm new in c#.net and i also look some this kind of resource as you working on. Please tell me detail about you project, i mean how to connection a remote web server and download file (.zip,.doc,.jpg) using Winform application.
Best Regard,
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Dear Waqas Assalam-m-Alekum
as faar as ur learning is concerned the only thing is that u can use HttpWebRequest HttpWebResponse Classess to get the HTTP Headers
and WebClient to get the File Downloaded or uploaded
for more info and Detialed Code refer to MSDN or any other site about these clasess
Regards
Tariq Rahim
TAriq
|
|
|
|
|
I read the article "How to create installation patches for VS.NET deployment projects" by mjmeans.
I tried in the same way, they suggested. It works great. But it is working only First time.
I mean, I installed small project in my machine, and I made small changes in my project and created patch in the same way described in the article. I installed that patch, it works fine. Then again I made some other changes and created the patch. In the patch log, it shows correctly the changes files added in the patch. But When I execute the patch, the changes not applied to installed project. Only first time patch working.
I checked the mail address for mjmeans, but I cannot get it.
Azmal
|
|
|
|
|
In C++ I recieved data from a DLLIMPORT call in a char string as follows:
void funct()
{
char *icy=BASS_StreamGetTags( Channel, BASS_TAG_ICY);
for (;*icy;icy+=strlen(icy)+1)
{
char * lowercase;
lowercase = _strlwr(icy);
if (!memcmp(icy,"title :",7))
{
temp = icy;
pCPlayer->WMA_Title = CamelCase(temp.Right(temp.GetLength() - 8));
TRACE("TITLE:"); TRACE( pCPlayer->WMA_Title ); TRACE( "\n");
}
if (!memcmp(icy,"author :",8))
{
temp = icy;
pCPlayer->WMA_Author = CamelCase(temp.Right(temp.GetLength() - 9));
TRACE("AUTHOR:"); TRACE( pCPlayer->WMA_Author ); TRACE( "\n");
}
}
}
In C# I am returning the data to a string. How do I walk thru the data in a C# string like I did in the above example?
|
|
|
|
|
How is the data arranged in the string? What is the separator between the strings in the stream? Is it still a zero character?
---
b { font-weight: normal; }
|
|
|
|
|
The data is a pointer to a series of null-terminated strings is returned, the final string ending with a double null.
|
|
|
|
|
If you have that data in a string, just split it on '\x00' and don't use the last two records in the array, as they will be the strings between the last two terminators and between the last terminator and the end of the string.
---
b { font-weight: normal; }
|
|
|
|
|
Well I ended up doing the following. When I used string as the return value I was only getting the first chuck of data and not the rest.
IntPtr icy = BASS_StreamGetTags( radioChan, BASS_TAG_ICY );
byte[] bytetag = new byte[512];
if (icy != IntPtr.Zero)
{
Marshal.Copy(icy, bytetag, 0, bytetag.Length);
}
ASCIIEncoding encoding = new ASCIIEncoding( );
string constructedString = encoding.GetString(bytetag);
if (constructedString != string.Empty)
{
string tokenizer = "\x00\0";
string[] token = constructedString.Split( tokenizer.ToCharArray(), 13 );
}
Thanks for your help
|
|
|
|
|
Hi all
Is there an easy way to check whether a string contains invalid file name characters or is this a case of "write your own".
Thanks again
MrR_
Nothing is foolproof to the talented fool.
|
|
|
|
|
|
Hi!
The Path class has a static member InvalidPathChars you can use:
bool IsFilenameValid(string filename)
{
return (filename.IndexOfAny(Path.InvalidPathChars) == -1);
}
Regards,
mav
|
|
|
|
|
HELLO
I want to set 1 Month expiry date for my software.
How can I do this.User can set system clock in back date,So how can i check this.
Using Dot Net how can I make installable setup.Should I write registry keys at time of installation.
If yes how?
Regards
|
|
|
|
|
|
Webservice is notpossible in my case.There are products in market that have trial version for 1 month.After one month they got expired like Norton ani virus.Even if we set system clock in back dates..How they do this...
|
|
|
|
|
To prevent back-date being used, implement a scheme like this:
1. At the time of installation, set the date of installation .
2. At the time of every use of software, set some variable for that date as the last date used and store it somewhere for further use. If this variable already contains a date which is later than the date of fresh use of software, do NOT reset it and let it contain that later date.
3. Next, at the time of every use of software, check for today's date . If this date is prior to the last date used stored in step 2 above, then set today's date to the aforesaid last date used . Now check the validity of software from this "revised today's date" from the date of installation and see whether it is less than 30 days or more.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|
|
Hi
I have an additional question:
Where should I store the date of installation ?
The user should not be able to delete or change it.
Thanks.
-- modified at 9:17 Wednesday 9th November, 2005
|
|
|
|
|
I have an app that (at the moment) moves through files that are on a web site, and deletes them, wat i want to do for the next stage, is to be able to download each file before i delete it.
i have tried POSTin to be able to view the image, then saving it, but it doesnt work, the problem i have is that all the files on the server have the same name, which is
http://1.1.1.1/DH/repository/content.tif
and for me to be able to view one, i had to send the follow command (that has a fwe ids that tell me the server which file i want)
show=&did=31374&rid=6_2_6_1_2_1&sid=174709756905990&WidthSize=136&useSavedParam=&dummy=
once i did this i got the followin content response
HTTP/1.1 200 OK
Server: Web-Server/3.0 GW-Repository
Content-Length: 24434
Content-Type: image/x-tiff
Set-Cookie: cookieOnOffChecker=on; path=/
Connection: close
MM
i have tried to use the WebClient.DownloadData(http://1.1.1.1/DH/repository/content.tif)
but it simply returns an error.
Does enyone have any ideas.
Thanx in advance
|
|
|
|
|
Create a streamReader from the response stream, create a file and then write the contents of the response to the file.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Thanx andy, i added this code and it seemed at first to work perfectly
Stream stream = webResponse.GetResponseStream();
Stream imageFile = File.Create(@"C:\IMAGES\image.tif");
Bitmap b = new Bitmap(stream);
b.Save(imageFile, ImageFormat.Tiff);
as i said this works perfectly, but the problem is i have Multi-page Tif images (ie ones that save with more then 1 page), with the above code it seems to only be saving the first page.
any ideas, i thought at first that the server may only return the content of the first page, but when i run it through IE (with fiddler) and view the file i am able to move through all of its pages.
|
|
|
|
|
I'd suspect that the bitmap only supports a single image.
Try something like this:
byte[] buffer = new buffer[1024];
int count;
while ((count = responseStream.Read(buffer, 0, buffer.Length)) > 0)
fileStream.Write(buffer, 0, count);
That should get you the file.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Thanx Andy, the code u supplied work perfectly, now it gets all the pags in teh TIF image, and my app has been finished and released.
Thanx again
|
|
|
|
|
Hi,
I am using the listview in the grid format i.e Listview.View.Details.
I have an urgent requrement where in I have to show checkbox and combo boxes in each subitems. In other words there should be few checkbox columns and few combobox columns in the listview.
Currently I am able to show check box for each item in the listview(i.e each row) but I need it for each cells.
Any help/suggestions is highly appreciated
Regards
Hitesh
hiteshsalian@yahoo.co.in
|
|
|
|
|
Serach Code Project. There are very good articles exemplifying exactly that.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I have written a simple server/client program in C# using System.Net.Sockets, when I attempt to connect to my own computer using the local ipaddress it works fine. When I attempt to connect to other computers using my server program it doesn't work. When I attempt to connect to my own computer using my true ip address it doesn't work. I am connecting using TCP, anybody know why this happens?
|
|
|
|