Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 118,873 C# Programmers for FREE! Ask your question and get quick answers from experts. There are 1,812 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



split string not working in server

 
Reply to this topicStart new topic

split string not working in server

juancho2114
post 18 Jul, 2008 - 07:41 AM
Post #1


New D.I.C Head

*
Joined: 18 Jul, 2008
Posts: 4

Hi, i have an web site (ASPX - C#) that split a tab delimiter file.

On the local machine, it works fine, it split the file and reads it correctly. I have done it in several ways.

Whe i publish the web site in the server and use the web site, the split method doesnīt work.

Anyone have any ideas?

This is the code:
CODE

char[] delimiterChars = {Convert.ToChar(9) };
                    
string[] words = strLine.Split(delimiterChars);

I have also done in this way and works locally:
objCulture.NumberFormat.NumberGroupSeparator = ",";
objCulture.NumberFormat.NumberDecimalSeparator = ".";
objCulture.TextInfo.ListSeparator = "" + Convert.ToChar(9);

char[] delimiterChars = {char.Parse(objCulture.TextInfo.ListSeparator)};
string[] words = strLine.Split(delimiterChars);
User is offlineProfile CardPM

Go to the top of the page


djkitt
post 18 Jul, 2008 - 08:15 AM
Post #2


D.I.C Head

**
Joined: 22 May, 2008
Posts: 128



Thanked 13 times
My Contributions


QUOTE(juancho2114 @ 18 Jul, 2008 - 09:41 AM) *

Hi, i have an web site (ASPX - C#) that split a tab delimiter file.

On the local machine, it works fine, it split the file and reads it correctly. I have done it in several ways.

Whe i publish the web site in the server and use the web site, the split method doesnīt work.

Anyone have any ideas?




In what way doesn't it work? What does the split return?



User is offlineProfile CardPM

Go to the top of the page

juancho2114
post 18 Jul, 2008 - 08:20 AM
Post #3


New D.I.C Head

*
Joined: 18 Jul, 2008
Posts: 4

QUOTE(djkitt @ 18 Jul, 2008 - 08:15 AM) *

QUOTE(juancho2114 @ 18 Jul, 2008 - 09:41 AM) *

Hi, i have an web site (ASPX - C#) that split a tab delimiter file.

On the local machine, it works fine, it split the file and reads it correctly. I have done it in several ways.

Whe i publish the web site in the server and use the web site, the split method doesnīt work.

Anyone have any ideas?




In what way doesn't it work? What does the split return?


in both ways it works, even using '\t' works on the local machine. I access the positions of the output array directly but i canīt get the positions. I insert the results in a datatable, row by row but when i run it on the server, the datatable appears in blank.


Thanks.
User is offlineProfile CardPM

Go to the top of the page

jayman9
post 18 Jul, 2008 - 08:26 AM
Post #4


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,474



Thanked 28 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Have you verified that the text file always has Tab as the delimiter?

Are you writing to the file at any point that might be removing the delimiters?
User is offlineProfile CardPM

Go to the top of the page

juancho2114
post 18 Jul, 2008 - 08:45 AM
Post #5


New D.I.C Head

*
Joined: 18 Jul, 2008
Posts: 4

QUOTE(jayman9 @ 18 Jul, 2008 - 08:26 AM) *

Have you verified that the text file always has Tab as the delimiter?

Are you writing to the file at any point that might be removing the delimiters?


Thatīs preciselly the issue. I run the web site on the local machine and it reads the text file y shows it on the dataGrid.
Then, i publish the site and posted on the serverīs iis.
Access the web site on the server, use the same file, but the application doesnīt read the file.

I have to read multiple types of files, comma separated, etc. and all works fine in both, the local machine and the server, the only exception is the tab separated file.

thanks.
User is offlineProfile CardPM

Go to the top of the page

jayman9
post 18 Jul, 2008 - 09:08 AM
Post #6


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,474



Thanked 28 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Ok, but you didn't answer my question.

At any time, is a new text file being written, while your application is running on the server?

Is it possible that the delimiter is being removed?
User is offlineProfile CardPM

Go to the top of the page

juancho2114
post 18 Jul, 2008 - 09:10 AM
Post #7


New D.I.C Head

*
Joined: 18 Jul, 2008
Posts: 4

QUOTE(jayman9 @ 18 Jul, 2008 - 09:08 AM) *

Ok, but you didn't answer my question.

At any time, is a new text file being written, while your application is running on the server?

Is it possible that the delimiter is being removed?



Hi, no, the file is only read. In the local machine, i run it step by step and i can see the \t in each row.

Thanks
User is offlineProfile CardPM

Go to the top of the page

jayman9
post 18 Jul, 2008 - 12:42 PM
Post #8


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,474



Thanked 28 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Can't you just make it a comma separated file, like the others?
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 02:11AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month