Showing posts with label thisi. Show all posts
Showing posts with label thisi. Show all posts

Saturday, March 24, 2012

Serialize/Send a recordset content through network

Hi, the scenario should be like this:
I have a "Server" application, and a UserControl running on an asp.net page.
The UserControl sends a SQL Query string via UDP to the Server (after some
sort of authentication, etc etc)
The Server Application executes the query on his local SQL2k server
The Server Application gets the recordset returned by query execution
Then the server application sends to the UserControl the recordset returned
by the query execution
Could this be done? Like using a sort of Serialization of the SQLDataReader?
Or should i use another tecnique?
My target is to avoid opening the SQLServer directly to the public internet,
but to redirect all the queryes to my application, using some sort of
authentication and encryption.
I'm nearly new to .net framework so i'm discovering new things every day.
Thanx a lot for the help, and for any link that will be useful
MarcoMarco:
The scenario you describe sounds very much like a case where you would use a
web service. Since web services already use XML and SOAP, you will have the
serialization in the format you require.
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
"M. Simioni" <m.simioniREMOVETHIS@.TOCONTACTMEwooow.it> wrote in message
news:1RRee.7789$TR5.6704@.news.edisontel.com...
> Hi, the scenario should be like this:
> I have a "Server" application, and a UserControl running on an asp.net
page.
> The UserControl sends a SQL Query string via UDP to the Server (after some
> sort of authentication, etc etc)
> The Server Application executes the query on his local SQL2k server
> The Server Application gets the recordset returned by query execution
> Then the server application sends to the UserControl the recordset
returned
> by the query execution
> Could this be done? Like using a sort of Serialization of the
SQLDataReader?
> Or should i use another tecnique?
> My target is to avoid opening the SQLServer directly to the public
internet,
> but to redirect all the queryes to my application, using some sort of
> authentication and encryption.
> I'm nearly new to .net framework so i'm discovering new things every day.
> Thanx a lot for the help, and for any link that will be useful
> Marco
>
Well, i forgot to mention, but i also need to fire events from the server
application to the user control.
The goal of the server application isn't only to be a 'forwarder' of sql
query commands from clients to db, but also should fire events to client
when something happens (like packets received from the rs232 located on the
server).
I planned to use an exchange of UDP message between the 'server application'
and the user control to exchange events (from srvr -> client) and sql
queryes (from client->srvr). But i couldn't realize how to exchange sql
resulting recordsets.
Can i do this with web services too? or should i split the two tasks in
a) a server application that send udp messages to 'clients'
b) a web service that the 'clients' use to query the database
sorry for my bad english :)
Marco
"David Lloyd" <info@.LemingtonConsulting.com> ha scritto nel messaggio
news:ZNSee.3282$0i3.1968@.bignews3.bellsouth.net...
> Marco:
> The scenario you describe sounds very much like a case where you would use
> a
> web service. Since web services already use XML and SOAP, you will have
> the
> serialization in the format you require.
>
> --
> David Lloyd
> MCSD .NET
> http://LemingtonConsulting.com
> This response is supplied "as is" without any representations or
> warranties.
>
> "M. Simioni" <m.simioniREMOVETHIS@.TOCONTACTMEwooow.it> wrote in message
> news:1RRee.7789$TR5.6704@.news.edisontel.com...
> page.
> returned
> SQLDataReader?
> internet,
>
Marco,
You never can sent something to a client. Therefore is to much protected.
You can communicate with a client when he has on the other side a program
that accept what you sent.
I think as well that the suggestion from David can maybe be a good solution
for you. We can never see from this newsgroup if it real fits. Have a look
at this pages.
http://msdn.microsoft.com/library/d...r />
hrough.asp
I expect however as well, that trying to reach your goall with a recordset
can be much harder than using the ADONET components.
I hope this helps,
Cor

Thursday, March 22, 2012

Serve CSV file in new window

Hi,

Really stuck with this one, or the fact that I have just had a baby
maybe mind mind is in meltdown and I cant figure how to solve this!

I have a list of users stored in session. These users are displayed in
a list on the admin web page and I would like to give the
administrator a dropdown of actions on this list. For example, print
this list, Email this list etc.

The print list actually creates a PDF document so the admin can do what
they like with it, so this is where I get hazy....

How do I open this PDF in a new window on a form submit? For example
with a link thats fine, target="_blank" but the form is posted back to
the server and I realise that there is no way of doing this at the
server, so at the moment I have a literal js statement that is set
visible true and this opens the new window when the page is rendered
after the postback.. This strikes me as *ahem* "not the best way" for
example with popup blockers etc.

Is there a way to render the page to a new window? I was perhaps
thinking of creating a PDF HTTPhandler which would force a download
which I hope will not move the window from the orignal page? Is this
the correct way?

Any help appreciated

Many thanks

RichardAdd the target attribute to the form.

<form action="your pdf creating page.aspx" target="_blank">

"rgparkins" <rgparkins@.hotmail.comwrote in message
news:1162809188.972941.278650@.m7g2000cwm.googlegro ups.com...

Quote:

Originally Posted by

Hi,
>
Really stuck with this one, or the fact that I have just had a baby
maybe mind mind is in meltdown and I cant figure how to solve this!
>
I have a list of users stored in session. These users are displayed in
a list on the admin web page and I would like to give the
administrator a dropdown of actions on this list. For example, print
this list, Email this list etc.
>
The print list actually creates a PDF document so the admin can do what
they like with it, so this is where I get hazy....
>
How do I open this PDF in a new window on a form submit? For example
with a link thats fine, target="_blank" but the form is posted back to
the server and I realise that there is no way of doing this at the
server, so at the moment I have a literal js statement that is set
visible true and this opens the new window when the page is rendered
after the postback.. This strikes me as *ahem* "not the best way" for
example with popup blockers etc.
>
Is there a way to render the page to a new window? I was perhaps
thinking of creating a PDF HTTPhandler which would force a download
which I hope will not move the window from the orignal page? Is this
the correct way?
>
Any help appreciated
>
Many thanks
>
Richard
>


Hi Aidy

Hi Aidy thanks for your reply.. I understand that the web page in .NET
is contained within a single form element and I have many buttons and
links in this page as well as my dropdown & Go button to print labels,
print envelopes as options.. I cannot see how to add this target onto
just the dropdown and Go Button. I presume that if I add this to the
form element then all the buttons will form a new window?

Thanks again for your help

Rich

Aidy wrote:

Quote:

Originally Posted by

Add the target attribute to the form.
>
<form action="your pdf creating page.aspx" target="_blank">
>
"rgparkins" <rgparkins@.hotmail.comwrote in message
news:1162809188.972941.278650@.m7g2000cwm.googlegro ups.com...

Quote:

Originally Posted by

Hi,

Really stuck with this one, or the fact that I have just had a baby
maybe mind mind is in meltdown and I cant figure how to solve this!

I have a list of users stored in session. These users are displayed in
a list on the admin web page and I would like to give the
administrator a dropdown of actions on this list. For example, print
this list, Email this list etc.

The print list actually creates a PDF document so the admin can do what
they like with it, so this is where I get hazy....

How do I open this PDF in a new window on a form submit? For example
with a link thats fine, target="_blank" but the form is posted back to
the server and I realise that there is no way of doing this at the
server, so at the moment I have a literal js statement that is set
visible true and this opens the new window when the page is rendered
after the postback.. This strikes me as *ahem* "not the best way" for
example with popup blockers etc.

Is there a way to render the page to a new window? I was perhaps
thinking of creating a PDF HTTPhandler which would force a download
which I hope will not move the window from the orignal page? Is this
the correct way?

Any help appreciated

Many thanks

Richard


there is no way to make the decision server side. you need to do it client
side. client code could change the form target.

-- bruce (sqlwork.com)

"rgparkins" <rgparkins@.hotmail.comwrote in message
news:1162809188.972941.278650@.m7g2000cwm.googlegro ups.com...

Quote:

Originally Posted by

Hi,
>
Really stuck with this one, or the fact that I have just had a baby
maybe mind mind is in meltdown and I cant figure how to solve this!
>
I have a list of users stored in session. These users are displayed in
a list on the admin web page and I would like to give the
administrator a dropdown of actions on this list. For example, print
this list, Email this list etc.
>
The print list actually creates a PDF document so the admin can do what
they like with it, so this is where I get hazy....
>
How do I open this PDF in a new window on a form submit? For example
with a link thats fine, target="_blank" but the form is posted back to
the server and I realise that there is no way of doing this at the
server, so at the moment I have a literal js statement that is set
visible true and this opens the new window when the page is rendered
after the postback.. This strikes me as *ahem* "not the best way" for
example with popup blockers etc.
>
Is there a way to render the page to a new window? I was perhaps
thinking of creating a PDF HTTPhandler which would force a download
which I hope will not move the window from the orignal page? Is this
the correct way?
>
Any help appreciated
>
Many thanks
>
Richard
>

Serve CSV file in new window

Hi,
Really stuck with this one, or the fact that I have just had a baby
maybe mind mind is in meltdown and I cant figure how to solve this!
I have a list of users stored in session. These users are displayed in
a list on the admin web page and I would like to give the
administrator a dropdown of actions on this list. For example, print
this list, Email this list etc.
The print list actually creates a PDF document so the admin can do what
they like with it, so this is where I get hazy....
How do I open this PDF in a new window on a form submit? For example
with a link thats fine, target="_blank" but the form is posted back to
the server and I realise that there is no way of doing this at the
server, so at the moment I have a literal js statement that is set
visible true and this opens the new window when the page is rendered
after the postback.. This strikes me as *ahem* "not the best way" for
example with popup blockers etc.
Is there a way to render the page to a new window? I was perhaps
thinking of creating a PDF HTTPhandler which would force a download
which I hope will not move the window from the orignal page? Is this
the correct way?
Any help appreciated
Many thanks
RichardAdd the target attribute to the form.
<form action="your pdf creating page.aspx" target="_blank">
"rgparkins" <rgparkins@.hotmail.com> wrote in message
news:1162809188.972941.278650@.m7g2000cwm.googlegroups.com...
> Hi,
> Really stuck with this one, or the fact that I have just had a baby
> maybe mind mind is in meltdown and I cant figure how to solve this!
> I have a list of users stored in session. These users are displayed in
> a list on the admin web page and I would like to give the
> administrator a dropdown of actions on this list. For example, print
> this list, Email this list etc.
> The print list actually creates a PDF document so the admin can do what
> they like with it, so this is where I get hazy....
> How do I open this PDF in a new window on a form submit? For example
> with a link thats fine, target="_blank" but the form is posted back to
> the server and I realise that there is no way of doing this at the
> server, so at the moment I have a literal js statement that is set
> visible true and this opens the new window when the page is rendered
> after the postback.. This strikes me as *ahem* "not the best way" for
> example with popup blockers etc.
> Is there a way to render the page to a new window? I was perhaps
> thinking of creating a PDF HTTPhandler which would force a download
> which I hope will not move the window from the orignal page? Is this
> the correct way?
> Any help appreciated
> Many thanks
> Richard
>
Hi Aidy
Hi Aidy thanks for your reply.. I understand that the web page in .NET
is contained within a single form element and I have many buttons and
links in this page as well as my dropdown & Go button to print labels,
print envelopes as options.. I cannot see how to add this target onto
just the dropdown and Go Button. I presume that if I add this to the
form element then all the buttons will form a new window?
Thanks again for your help
Rich
Aidy wrote:
> Add the target attribute to the form.
> <form action="your pdf creating page.aspx" target="_blank">
> "rgparkins" <rgparkins@.hotmail.com> wrote in message
> news:1162809188.972941.278650@.m7g2000cwm.googlegroups.com...
there is no way to make the decision server side. you need to do it client
side. client code could change the form target.
-- bruce (sqlwork.com)
"rgparkins" <rgparkins@.hotmail.com> wrote in message
news:1162809188.972941.278650@.m7g2000cwm.googlegroups.com...
> Hi,
> Really stuck with this one, or the fact that I have just had a baby
> maybe mind mind is in meltdown and I cant figure how to solve this!
> I have a list of users stored in session. These users are displayed in
> a list on the admin web page and I would like to give the
> administrator a dropdown of actions on this list. For example, print
> this list, Email this list etc.
> The print list actually creates a PDF document so the admin can do what
> they like with it, so this is where I get hazy....
> How do I open this PDF in a new window on a form submit? For example
> with a link thats fine, target="_blank" but the form is posted back to
> the server and I realise that there is no way of doing this at the
> server, so at the moment I have a literal js statement that is set
> visible true and this opens the new window when the page is rendered
> after the postback.. This strikes me as *ahem* "not the best way" for
> example with popup blockers etc.
> Is there a way to render the page to a new window? I was perhaps
> thinking of creating a PDF HTTPhandler which would force a download
> which I hope will not move the window from the orignal page? Is this
> the correct way?
> Any help appreciated
> Many thanks
> Richard
>

Tuesday, March 13, 2012

server application aspnet_wp.exe stopped unexpectedly unavailable

hi,

I'm having an absolute nightmare with this!

I've seen many posts on the subject but still can't quite figure it
out.

I'm using csharp and Framework 1.1.4322.537 on Windows2000 Professional
5.00.2195 Service Pack 4

I click a hyperlink which takes me to an aspx page with a document ID
in the request string. The aspx page checks if there is a doc_id in the
request string. If there is, it looks at a Session variable DataView to
find the location of the document based on the doc_id (don't want users
to see actual location).

Once it has this info, it puts that into another Session Variable and
does a Response.Redirect to the same aspx page but with a user-friendly
request string i.e document=documentType.documentName

On reentry, the page sees this request string, finds the location from
the session variable and uses the following code to serve the PDF file:
if(impersonateValidUser("user", "domain", "password"))
{
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.WriteFile(pdfFile);
Response.Flush();
Response.Close();
undoImpersonation();
}
else
{
}
return;

using the standard MS implementation of impersonation found here:
http://support.microsoft.com/defaul...kb;en-us;306158
EXCEPT that I am not doing it in Page_Load.

Code for Page_Load is:
//uses doc_id to identify which document from the dataset is required.
string objectName;
string objectType;
if (Request.QueryString["doc_id"] != null)
{
string docId = Request.QueryString["doc_id"];
System.Data.DataView documents =
(System.Data.DataView)Session["documents"];

if (documents == null)
throw new Exception("You must navigate via the Document Viewer and
select a document first.");
documents.RowFilter="doc_id="+ docId;
//check that there is a document
if (documents.Count==1)
{
objectName = documents[0].Row["object_name"].ToString();
objectType = documents[0].Row["r_object_type"].ToString();
pdfFile = (string)Session["pdfLocation"] +
documents[0].Row["DOCUrl"].ToString();
ArrayList pdfArray = new ArrayList();
pdfArray.Add(pdfFile);
pdfArray.Add(docId);
pdfArray.Add(objectName);
pdfArray.Add(objectType);
Session["pdfArray"] = pdfArray;
string newURL = HttpContext.Current.Request.Path + "?object=" +
objectType + "." + objectName;
Response.Redirect(newURL);
return;
}
else
{
throw new Exception("There is no such document id in the
current dataset.");
}
}
else
{
if (Session["pdfArray"] != null && Request.QueryString["object"] !=
null)
{
if (((ArrayList)Session["pdfArray"]).Count == 4)
{
pdfFile = (string)((ArrayList)Session["pdfArray"])[0];
objectName = (string)((ArrayList)Session["pdfArray"])[2];
objectType = (string)((ArrayList)Session["pdfArray"])[3];
string[] objRequest =
Request.QueryString["object"].Split(".".ToCharArray());
if (objRequest.Length == 2)
{
if (objRequest[0] != objectType || objRequest[1] != objectName)
throw new Exception("This is not a valid document.");
}
else
throw new Exception("This is not a valid document.");
ServePDF();
return;
}
else
{
throw new Exception("This is not a valid document.");
}
}
else
{
throw new Exception("This is not a valid document.");
}
}

string pdfFile is a class variable.

Now, this code works fine for 3 of my documents which are under 200kb
but the one that is 3822KB fails with the error message Server
Application Unavailable and the event log says aspnet_wp.exe stopped
unexpectedly.

The machine.config is set to use SYSTEM (though with Framework 1.1 I
don't think this should be necessary, and indeed it may not be - have
now tested "machine" and that seems to work the same). The httpRuntime
MaxRequestLength in machine.config was 4096 and since this was close I
upped it to 8192 but that didn't fix it. This setting is not overridden
in the web.config file.

What may give the game away (but not to me!) is that the Page_Load is
triggerred 3 times instead of the 2 I was expecting. Once with the
doc_id, then after the Redirect but then a third time? Presumably
something to do with the Response.Flush or Response.Close...

Can anyone help me? Even more frustrating is that I actually had this
big file working occasionally yesterday though it would randomly cause
this error message. However, after my tinkering it always produces the
error now :o( (only for the large file).

thanks
Phili should say I have also tried without impersonation (having set the
directory permissions appropriately, though my final application will
need to use impersonation or delegation - that's a whole different
question!).

Even without impersonation I still get the same problem.

Phil
can someone at least tell me why Page_Load is being triggerred 3 times
in this example?

I really can't figure out why the failure is so random...
phancey@.2bytes.co.uk wrote:
> can someone at least tell me why Page_Load is being triggerred 3
times
> in this example?
> I really can't figure out why the failure is so random...

That's a bug. Install .net framework 1.1 sp1. this would help.
by the way, for anyone else having this problem, it turned out to be
the size of the file at 3822KB. I ended up having to read it in chunks
and outputting it with flush before reading the next chunk. I used
500000 byte chunks and it seems to work fine. There may be an
alternative solution but this is what I ended up doing.

server application aspnet_wp.exe stopped unexpectedly unavailable

hi,
I'm having an absolute nightmare with this!
I've seen many posts on the subject but still can't quite figure it
out.
I'm using csharp and Framework 1.1.4322.537 on Windows2000 Professional
5.00.2195 Service Pack 4
I click a hyperlink which takes me to an aspx page with a document ID
in the request string. The aspx page checks if there is a doc_id in the
request string. If there is, it looks at a Session variable DataView to
find the location of the document based on the doc_id (don't want users
to see actual location).
Once it has this info, it puts that into another Session Variable and
does a Response.Redirect to the same aspx page but with a user-friendly
request string i.e document=documentType.documentName
On reentry, the page sees this request string, finds the location from
the session variable and uses the following code to serve the PDF file:
if(impersonateValidUser("user", "domain", "password"))
{
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.WriteFile(pdfFile);
Response.Flush();
Response.Close();
undoImpersonation();
}
else
{
}
return;
using the standard MS implementation of impersonation found here:
http://support.microsoft.com/defaul...kb;en-us;306158
EXCEPT that I am not doing it in Page_Load.
Code for Page_Load is:
//uses doc_id to identify which document from the dataset is required.
string objectName;
string objectType;
if (Request.QueryString["doc_id"] != null)
{
string docId = Request.QueryString["doc_id"];
System.Data.DataView documents =
(System.Data.DataView)Session["documents"];
if (documents == null)
throw new Exception("You must navigate via the Document Viewer and
select a document first.");
documents.RowFilter="doc_id="+ docId;
//check that there is a document
if (documents.Count==1)
{
objectName = documents[0].Row["object_name"].ToString();
objectType = documents[0].Row["r_object_type"].ToString();
pdfFile = (string)Session["pdfLocation"] +
documents[0].Row["DOCUrl"].ToString();
ArrayList pdfArray = new ArrayList();
pdfArray.Add(pdfFile);
pdfArray.Add(docId);
pdfArray.Add(objectName);
pdfArray.Add(objectType);
Session["pdfArray"] = pdfArray;
string newURL = HttpContext.Current.Request.Path + "?object=" +
objectType + "." + objectName;
Response.Redirect(newURL);
return;
}
else
{
throw new Exception("There is no such document id in the
current dataset.");
}
}
else
{
if (Session["pdfArray"] != null && Request.QueryString["object"] !=
null)
{
if (((ArrayList)Session["pdfArray"]).Count == 4)
{
pdfFile = (string)((ArrayList)Session["pdfArray"])[0];
objectName = (string)((ArrayList)Session["pdfArray"])[2];
objectType = (string)((ArrayList)Session["pdfArray"])[3];
string[] objRequest =
Request.QueryString["object"].Split(".".ToCharArray());
if (objRequest.Length == 2)
{
if (objRequest[0] != objectType || objRequest[1] != objectName)
throw new Exception("This is not a valid document.");
}
else
throw new Exception("This is not a valid document.");
ServePDF();
return;
}
else
{
throw new Exception("This is not a valid document.");
}
}
else
{
throw new Exception("This is not a valid document.");
}
}
string pdfFile is a class variable.
Now, this code works fine for 3 of my documents which are under 200kb
but the one that is 3822KB fails with the error message Server
Application Unavailable and the event log says aspnet_wp.exe stopped
unexpectedly.
The machine.config is set to use SYSTEM (though with Framework 1.1 I
don't think this should be necessary, and indeed it may not be - have
now tested "machine" and that seems to work the same). The httpRuntime
MaxRequestLength in machine.config was 4096 and since this was close I
upped it to 8192 but that didn't fix it. This setting is not overridden
in the web.config file.
What may give the game away (but not to me!) is that the Page_Load is
triggerred 3 times instead of the 2 I was expecting. Once with the
doc_id, then after the Redirect but then a third time? Presumably
something to do with the Response.Flush or Response.Close...
Can anyone help me? Even more frustrating is that I actually had this
big file working occasionally yesterday though it would randomly cause
this error message. However, after my tinkering it always produces the
error now :o( (only for the large file).
thanks
Phili should say I have also tried without impersonation (having set the
directory permissions appropriately, though my final application will
need to use impersonation or delegation - that's a whole different
question!).
Even without impersonation I still get the same problem.
Phil
can someone at least tell me why Page_Load is being triggerred 3 times
in this example?
I really can't figure out why the failure is so random...
phancey@.2bytes.co.uk wrote:
> can someone at least tell me why Page_Load is being triggerred 3
times
> in this example?
> I really can't figure out why the failure is so random...
That's a bug. Install .net framework 1.1 sp1. this would help.
by the way, for anyone else having this problem, it turned out to be
the size of the file at 3822KB. I ended up having to read it in chunks
and outputting it with flush before reading the next chunk. I used
500000 byte chunks and it seems to work fine. There may be an
alternative solution but this is what I ended up doing.