Problem retrieving filesize

D

David Colliver

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top