Showing posts with label http. Show all posts
Showing posts with label http. Show all posts

Monday, March 26, 2012

System.MissingFieldException: Field not found

http://groups.google.com/groups?hl=...%26filter %3D0

The above thread is old but has anyone come up with a solution to this
issue? The intermittent problem started after I added a UserControl that
contains a third party control.

The problem does not occur on my development workstation. But I have a
development site on the same server which hosts the production site. I
simply copy the executable from this site to the production site. Invariably
when I access the production site again for the first time, I get a compile
error. If I replace the dll again, the site works fine. But only for another
few days until I get the same exception.

Obviously the temporary fix is unacceptable.Further to my previous post, here's the problem described in another forum:

http://gotdotnet.com/community/mess...141&Page=1&so=1

It appears this behavior occurs when a third party control is embedded in a
UserControl on non-development machines.

Anyone have any ideas? The application going down every few days is really
unacceptable. Thanks in advance.
Field not found: SmartSub.MenuBar.webMenu.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.MissingFieldException: Field not found:
SmartSub.MenuBar.webMenu.

Source Error:

[No relevant source lines]

Source File: c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Tempora ry ASP.NET
Files\smartsub\c3628410\4e846907\y7d4qwa4.0.cs Line: 0

Stack Trace:

[MissingFieldException: Field not found: SmartSub.MenuBar.webMenu.]
ASP.MenuBar_ascx.__BuildControlTree(Control __ctrl) +0
ASP.MenuBar_ascx.FrameworkInitialize() in
c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Tempora ry ASP.NET
Files\smartsub\c3628410\4e846907\y7d4qwa4.0.cs:0
System.Web.UI.UserControl.InitializeAsUserControlI nternal() +31
System.Web.UI.UserControl.InitializeAsUserControl( Page page) +15
ASP.Default_aspx.__BuildControlmenuBar() in C:\SmartSub\default.aspx:15
ASP.Default_aspx.__BuildControlformDefault() in
C:\SmartSub\default.aspx:14
ASP.Default_aspx.__BuildControlTree(Control __ctrl) in
C:\SmartSub\default.aspx:1
ASP.Default_aspx.FrameworkInitialize() in
c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Tempora ry ASP.NET
Files\smartsub\c3628410\4e846907\koa-hius.0.cs:0
System.Web.UI.Page.ProcessRequest() +84
System.Web.UI.Page.ProcessRequest(HttpContext context) +18

System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionSte
p.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87

-----------------------
--
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

Saturday, March 24, 2012

System.Net.WebClient.DownloadFile doesn't work with http attachments

Hi,
I have an aspx page at the web server that provides PDF documents for smart
client applications.
Here is the code in aspx page that defines content type:
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition",
"attachment;filename=test.pdf");
I tested the aspx page by using browser and it works just fine.
Now I need to receive that file by using the
System.Net.WebClient.DownloadFile. The problem is that DownloadFile method
returns the following exception:
"Unable to read data from the transport connection: The connection was
closed."
I tested the DownloadFile method to open a direct pdf file like the
following statement:
(new
System.Net.WebClient()).DownloadFile(http://localhost/test.pdf,"c:\\test.pdf
");
It works just fine.
How can I use System.Net.WebClient. DownloadFile to download http
attachments?
Any help would be apprecited,
AlanThe answer is in your question, but you may not recognize it.
An HTTP Request is for a single resource, identified by the URL of the
resource, or in the case of the WebClient, a URI plus a file descriptor. You
have an ASPX page that returns a file with a couple of special Response
Headers in it. Those Response Headers read:
Response.ContentType = "application/octet-stream";
> Response.AppendHeader("Content-Disposition",
"attachment;filename=test.pdf");
This header indicates that the client should prompt the client to make a
second request for the file descriptor specified (text.pdf), and that the
Content-Type of that file is binary.
So, what you have to do is read the Response Headers, and make a second
request for that file specified.
IETF RFC 1806 has a detailed explanation of this Response Header:
http://www.ietf.org/rfc/rfc1806.txt
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
A watched clock never boils.
"A.M-SG" <alanalan@.newsgroup.nospam> wrote in message
news:eY7l5Zu3FHA.1148@.tk2msftngp13.phx.gbl...
> Hi,
> I have an aspx page at the web server that provides PDF documents for
> smart
> client applications.
> Here is the code in aspx page that defines content type:
> Response.ContentType = "application/octet-stream";
> Response.AppendHeader("Content-Disposition",
> "attachment;filename=test.pdf");
> I tested the aspx page by using browser and it works just fine.
> Now I need to receive that file by using the
> System.Net.WebClient.DownloadFile. The problem is that DownloadFile method
> returns the following exception:
> "Unable to read data from the transport connection: The connection was
> closed."
> I tested the DownloadFile method to open a direct pdf file like the
> following statement:
> (new
> System.Net.WebClient()).DownloadFile(http://localhost/test.pdf,"c:\\test.p
df");
> It works just fine.
> How can I use System.Net.WebClient. DownloadFile to download http
> attachments?
> Any help would be apprecited,
> Alan
>

System.Net.WebClient.DownloadFile doesnt work with http attachments

Hi,

I have an aspx page at the web server that provides PDF documents for smart
client applications.

Here is the code in aspx page that defines content type:

Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition",
"attachment;filename=test.pdf");

I tested the aspx page by using browser and it works just fine.

Now I need to receive that file by using the
System.Net.WebClient.DownloadFile. The problem is that DownloadFile method
returns the following exception:

"Unable to read data from the transport connection: The connection was
closed."

I tested the DownloadFile method to open a direct pdf file like the
following statement:

(new
System.Net.WebClient()).DownloadFile(http://localhost/test.pdf,"c:\\test.pdf");

It works just fine.

How can I use System.Net.WebClient. DownloadFile to download http
attachments?

Any help would be apprecited,
AlanThe answer is in your question, but you may not recognize it.

An HTTP Request is for a single resource, identified by the URL of the
resource, or in the case of the WebClient, a URI plus a file descriptor. You
have an ASPX page that returns a file with a couple of special Response
Headers in it. Those Response Headers read:

Response.ContentType = "application/octet-stream";
> Response.AppendHeader("Content-Disposition",
"attachment;filename=test.pdf");

This header indicates that the client should prompt the client to make a
second request for the file descriptor specified (text.pdf), and that the
Content-Type of that file is binary.

So, what you have to do is read the Response Headers, and make a second
request for that file specified.

IETF RFC 1806 has a detailed explanation of this Response Header:

http://www.ietf.org/rfc/rfc1806.txt

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

"A.M-SG" <alanalan@.newsgroup.nospam> wrote in message
news:eY7l5Zu3FHA.1148@.tk2msftngp13.phx.gbl...
> Hi,
> I have an aspx page at the web server that provides PDF documents for
> smart
> client applications.
> Here is the code in aspx page that defines content type:
> Response.ContentType = "application/octet-stream";
> Response.AppendHeader("Content-Disposition",
> "attachment;filename=test.pdf");
> I tested the aspx page by using browser and it works just fine.
> Now I need to receive that file by using the
> System.Net.WebClient.DownloadFile. The problem is that DownloadFile method
> returns the following exception:
> "Unable to read data from the transport connection: The connection was
> closed."
> I tested the DownloadFile method to open a direct pdf file like the
> following statement:
> (new
> System.Net.WebClient()).DownloadFile(http://localhost/test.pdf,"c:\\test.pdf");
> It works just fine.
> How can I use System.Net.WebClient. DownloadFile to download http
> attachments?
> Any help would be apprecited,
> Alan