473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Problem retrieving filesize

Hi all,

I am having a slight issue with the code below.

************************************************** *****

string cszServerName = Page.Request.ServerVariables.Get
("SERVER_NAME");

HttpWebRequest HttpWReq = (HttpWebRequest)
WebRequest.Create("http://" + cszServerName +
Page.Request.Form["MAPH_AttLink_"+sPhName+"_"+i.ToString
()]);
HttpWReq.PreAuthenticate = true;
NetworkCredential networkCredential = new
NetworkCredential("my_admin_user","my_admin_pass") ;
HttpWReq.Credentials=networkCredential;

HttpWebResponse HttpWResp = (HttpWebResponse)
HttpWReq.GetResponse();
FileLength = " (" + docFileType +
(HttpWResp.ContentLength/1024).ToString() + "KB)";
HttpWResp.Close();

************************************************** *****

I am using this code in a placeholder control for
Microsoft CMS. I asked in the CMS group but got pointed
over here...

If anyone is aware of CMS, here is the background.
I am using a MultiAttachmentPlaceholder control which
overrides the HTMLPlaceholder control of CMS. In here is
a SavePlaceholderContent method.

In the placeholder, I have uploaded various files. Due to
the way CMS works, I cannot use filesystem to get the
files, I have to go through HTTP, so here I am.

When I save first article in CMS, the code runs
absolutely fine. Edit and resave article (after first
save) then the code fails (but only if I have
attachments). If I remove the code shown above,
everything works fine all the time.

However, and this is the real punch... if I debug and
step through, it goes through the code OK but fails just
before exiting the method with a "source code not found"
error.

In actual use, the page just hangs, waiting for further
content to come down. (The page never finishes).

This is so weird and frustrating. All help is appreciated.

Best regards,
Dave Colliver.
http://www.Burton-on-TrentFOCUS.com

Nov 19 '05 #1
0 1086

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bert | last post by:
Hello, I'm using a script to handle downloads of files, it seems to work but I'm getting random server errors. I guess it has something to do with the filesize. The script will be needed to...
2
by: Kubaton Lover | last post by:
I'm still having a problem with the following code, but I can better describe the symptoms now. Code: <?php $uri = getenv('REQUEST_URI'); $pieces = explode('/',$uri); $file = $pieces;
1
by: Lukelrc | last post by:
Hi all. I'm having trouble connecting to my sql server database correctly beacause of value type problems, specifically the date fields. When i try and run the page i get the follwoing error: ...
13
by: JasBascom | last post by:
int main() { char record_typec = 'c'; record_typec = toupper(record_typec); * rec->Newcrecord.record_type = record_typec; etc etc \*********************************************\
4
by: C16 | last post by:
Hi All I have a simple download script for files on my website and I use the code below to download the files: $fp = fopen($filename, "rb"); if ( $fp ) { $filesize = $file;
0
by: Greg | last post by:
I am using the following code on a page called file.aspx to retrieve binary files from a SQL db, but if I try to retrieve a .exe file, it prompts me to download file.aspx instead of .exe. ...
0
by: anide | last post by:
Hi all I’ve some problem, I’m trying to converting a sorting algorithm from C++ to C#. In C++ I’ve compiled it using MSVC and its working properly, and in C# I’m using .NET Framework 2.0 (Visual...
16
by: Jm.GlezdeRueda | last post by:
Hi all, Im trying to read a 24bit bmp with fread, and i have some problems.. I want to read the whole structure in one time, but i dont know why, it only reads the first member well.. I have...
7
by: souravmallik | last post by:
Hello, I'm facing a big logical problem while writing a parser in VC++ using C. I have to parse a file in a chunk of bytes in a round robin fashion. Means, when I select a file, the parser...
0
by: iprogrammer | last post by:
i have a problem when i try to run my windows service ..which is "Error 1053: The service did not respond to the start or control request in a timely fashion" >after this i cannot anything with...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.