Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Thursday, March 29, 2012

Please advise on how to create an invoice system

i'm trying to create an asp webform for my own development. I'm trying to create an online invoice where people can enter details like "Customer Name, Address, Date, Total amount".

I'm able to create a webform which captures those details and insert/delete/delete to/from a mssql db.

But because each invoice should have some items, so i created another table (InvoiceDetails) which reference to the Invoice table. So i can create as many items as i want in each invoice.

How should i create webforms for the invoicedetails? Because i need to add dynamically and not fix 10 records to add/edit in the form. THus most probably i'll need to put all sql statements into 1 transaction in case 1 InvoiceDetail record fail, so i can rollback the Invoice and InvoiceDetail record.

are there any samples which has a similar scenario as me?Its an interesting scenario Michael, especially the cardinality of relationship & dynamic nature of this application. If formatting doesn't matter much at data-entry level, you can use editable datagrid to insert/edit/delete data. This will totally accomodate the dynamic nature of InvoiceDetails using this strong data-aware component in ASP.NET. However, for printing & display in invoice report format, you may need to postion the dynamic controls on the fly which may get difficult if positions need customized.

MSDN's article "Adding Controls to a Web Forms Page Programmatically" may help.
http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskaddingcontrolstowebformspageprogrammatically.asp?frame=true

I hope it helps.

-Adnan Masood
This is a job for a new application model. HTML sucks for this stuff. Imagine writing an ERP application for the Web.. Wait Oracle did it.. sort of.

You will probably want to employ some thrd party web controls from the folks at Infragistics. Adding detail lines to invoices without them will be a little kludgy.

I did it once and ended up doing it with a series of frames. A button on the header page took you to a detail page. After adding the data on the detail page you went back to the header. It was a lot of tedious work.
Hmm, I would have a form that adds a single item to the order. Then two buttons, one says "Add another item" and one says "Finish Order". Add another item just reloads the form and Finish Order goes to whatever the next step is.

For editing just use a datalist that binds to the order number.

I do a similar type system for magazine advertising rates for each year. A particular magazine can have 10 years worth of prices and each year can have 20 different rates (for various sizes). The datalist shows all 10 years (queried by the magazine ID) and when they select the edit button it changes all the prices into textboxes for that year only. So your datalist would show all items for a single order, and then allow editing of each individual item inside that order.
hmm... datalist.. but what if its a new invoice? Thus it will not be given a Invoice ID until its inserted into the database. So its kinda hard to bind the individual items to that invoice

thats why i'm asking for advise on whats the best practise for people who has done similar development..
While you are entering the invoice keep the database in some temp tables. Identify the record with a GUID.. after you are done editing copy that data from the temp tables into the production tables. This works well and requires no whacky state management. It depends on the level of sophistication you want. In my current business we don;t start out by entering an order/invoice. We enter contracts the contracts get attached to jobs and several people may be involved with entering the data about the contracts and jobs. As the work on the contract proceeds incremental invoices are issued.

Please enter a different password

Hi,

I just started with asp.net..I'm using theASP.NET LogoWeb Site Administration Tool to create a user. The problem is when i type ia a password for that user it keeps on displaying.."Please enter a different password", nomatter what password i enter...can anyone direct me to the solution for my problem?..

Big Smile [:D]

By default they have enabled stronger password validation:

http://msdn.microsoft.com/netframework/downloads/updates/fw20readme.aspx

Check out section "3.1.5 ASP.NET Membership Enforces Password Strength Requirements"

-Brock


Hi,

Thanx alot..this link definitely helped..

Big Smile [:D]Yes [Y]

Please enter a different password

i cant create a user buy going to the page or buy the admin page ...? ...ne ideas

Hello, execuse me, but your question is not understood at all by me. Please clarify your question in details so that we can help you out.

BTW: please use "bye" instead of "buy".

regards

Monday, March 26, 2012

Please help - how to create a Printer Friendly web page...

Dear Experts,
I've got a trouble problem that I need your help. The scenario is the
following:

1) I need to add a "Print" button to my web page;
2) by clicking this button, the web page should be able to print out a
well-formatted web page (printer friendly ). That means, I need to adjust the
printing margins (left, top, right, bottom) programmatically.

I really have no idea on how to achieve this but I know this is a very
typical scenario. Could you please give me some advices? Please help.

Thanks a lot.
TiggerAs long as the targetted browser is IE >= 5 you can use the onbeforeprint
and on afterprint events in javascript
(I found this out yeterday)
I wrote the code below to hide a print button and decrease the width when
the document is printed
Hope this helps,
mortb

<head>
<script language="javascript">
var originalWidth;
function window.onbeforeprint()
{
originalWidth = document.getElementById('_tblResult').style.width;
document.getElementById('_tblResult').style.width = '625px';
document.getElementById('_btnPrint').style.display = 'none';
}
function window.onafterprint()
{
document.getElementById('_tblResult').style.width = originalWidth;
document.getElementById('_btnPrint').style.display = 'inline';
}
</script>
</HEAD
"Tigger" <Tigger@.discussions.microsoft.com> wrote in message
news:C2D9F1F1-954D-448A-A201-BAAA332C866E@.microsoft.com...
> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
> the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
Use a media-specific print stylesheet.
For example, try slapping this in a file called print.css
@.page { 0.75in; }
And putting this line in your HTML
<link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=print.css" media="print"
At this point, you should be able to print from your browser normally. If
you need to initiate printing from a button, you should be able to do
something like this:
<input type="button" value="Print me!" onclick="window.print()"
This article might give you some ideas on other things you can do with this
techinque: http://www.alistapart.com/articles/goingtoprint/
And there's always the CSS reference: http://www.w3.org/TR/CSS21/

"Tigger" wrote:

> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>

Please help - how to create a Printer Friendly web page...

Dear Experts,
I've got a trouble problem that I need your help. The scenario is the
following:
1) I need to add a "Print" button to my web page;
2) by clicking this button, the web page should be able to print out a
well-formatted web page (printer friendly ). That means, I need to adjust th
e
printing margins (left, top, right, bottom) programmatically.
I really have no idea on how to achieve this but I know this is a very
typical scenario. Could you please give me some advices? Please help.
Thanks a lot.
TiggerAs long as the targetted browser is IE >= 5 you can use the onbeforeprint
and on afterprint events in javascript
(I found this out yeterday)
I wrote the code below to hide a print button and decrease the width when
the document is printed
Hope this helps,
mortb
<head>
<script language="javascript">
var originalWidth;
function window.onbeforeprint()
{
originalWidth = document.getElementById('_tblResult').style.width;
document.getElementById('_tblResult').style.width = '625px';
document.getElementById('_btnPrint').style.display = 'none';
}
function window.onafterprint()
{
document.getElementById('_tblResult').style.width = originalWidth;
document.getElementById('_btnPrint').style.display = 'inline';
}
</script>
</HEAD>
"Tigger" <Tigger@.discussions.microsoft.com> wrote in message
news:C2D9F1F1-954D-448A-A201-BAAA332C866E@.microsoft.com...
> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
> the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>
Use a media-specific print stylesheet.
For example, try slapping this in a file called print.css
@.page { 0.75in; }
And putting this line in your HTML
<link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=print.css" media="print">
At this point, you should be able to print from your browser normally. If
you need to initiate printing from a button, you should be able to do
something like this:
<input type="button" value="Print me!" onclick="window.print()">
This article might give you some ideas on other things you can do with this
techinque: http://www.alistapart.com/articles/goingtoprint/
And there's always the CSS reference: http://www.w3.org/TR/CSS21/
"Tigger" wrote:

> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>

Please help - weird problem

Hi,
While trying to create new directory i recieve the following error
message:
"System.IO.DirectoryNotFoundException: Could not find a part of the path
"\\premfs16\sites".
The path exists, even when i check the path
with the code: Directory.Exists(...) the result is true.

Here is the code:
http://www.adeo.co.il/test.aspx

Notice that in the line before the code throws exception
i create new file to the same path and no error
occurs - only when trying to create directory
the error appears.

Any idea?Yoni,

This is a security problem. You need to grant read permission for
\\premfs16\sites to the ASP.NET user.

Eliyahu

"?? ???" <@.discussions.microsoft.com> wrote in message
news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> Hi,
> While trying to create new directory i recieve the following error
> message:
> "System.IO.DirectoryNotFoundException: Could not find a part of the path
> "\\premfs16\sites".
> The path exists, even when i check the path
> with the code: Directory.Exists(...) the result is true.
> Here is the code:
> http://www.adeo.co.il/test.aspx
> Notice that in the line before the code throws exception
> i create new file to the same path and no error
> occurs - only when trying to create directory
> the error appears.
> Any idea?
So how do you explain that the code succeeded creating
a file (which needs to read the same path...) and only
creating a directory failed?

"Eliyahu Goldin" wrote:

> Yoni,
> This is a security problem. You need to grant read permission for
> \\premfs16\sites to the ASP.NET user.
> Eliyahu
> "?? ???" <@.discussions.microsoft.com> wrote in message
> news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > Hi,
> > While trying to create new directory i recieve the following error
> > message:
> > "System.IO.DirectoryNotFoundException: Could not find a part of the path
> > "\\premfs16\sites".
> > The path exists, even when i check the path
> > with the code: Directory.Exists(...) the result is true.
> > Here is the code:
> > http://www.adeo.co.il/test.aspx
> > Notice that in the line before the code throws exception
> > i create new file to the same path and no error
> > occurs - only when trying to create directory
> > the error appears.
> > Any idea?
>
Yoni,

Probably file creating doesn't require read permission but directory
creating does. I don't know exactly how all these permissions work.

Security and permission setting is a complicated matter. You don't really
need to understand fully the theoretical background. For your immediate
problem it's enough to know how other people solved the same problem. If you
wish to investigate - you are welcome to invest your time in that.

Eliyahu

"?? ???" <@.discussions.microsoft.com> wrote in message
news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> So how do you explain that the code succeeded creating
> a file (which needs to read the same path...) and only
> creating a directory failed?
> "Eliyahu Goldin" wrote:
> > Yoni,
> > This is a security problem. You need to grant read permission for
> > \\premfs16\sites to the ASP.NET user.
> > Eliyahu
> > "?? ???" <@.discussions.microsoft.com> wrote in message
> > news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > > Hi,
> > > While trying to create new directory i recieve the following error
> > > message:
> > > "System.IO.DirectoryNotFoundException: Could not find a part of the
path
> > > "\\premfs16\sites".
> > > The path exists, even when i check the path
> > > with the code: Directory.Exists(...) the result is true.
> > > > Here is the code:
> > > http://www.adeo.co.il/test.aspx
> > > > Notice that in the line before the code throws exception
> > > i create new file to the same path and no error
> > > occurs - only when trying to create directory
> > > the error appears.
> > > > Any idea?
>
The problem is much more sophisticated.
My web site host at shared hosting company.
No hosting company will allow users to have read
permissions on their root directory.
So what you are actually saying is that you can not
open directories on web sites which hosts on shared servers.
Is that correct?

"Eliyahu Goldin" wrote:

> Yoni,
> Probably file creating doesn't require read permission but directory
> creating does. I don't know exactly how all these permissions work.
> Security and permission setting is a complicated matter. You don't really
> need to understand fully the theoretical background. For your immediate
> problem it's enough to know how other people solved the same problem. If you
> wish to investigate - you are welcome to invest your time in that.
> Eliyahu
> "?? ???" <@.discussions.microsoft.com> wrote in message
> news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> > So how do you explain that the code succeeded creating
> > a file (which needs to read the same path...) and only
> > creating a directory failed?
> > "Eliyahu Goldin" wrote:
> > > Yoni,
> > > > This is a security problem. You need to grant read permission for
> > > \\premfs16\sites to the ASP.NET user.
> > > > Eliyahu
> > > > "?? ???" <@.discussions.microsoft.com> wrote in message
> > > news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > > > Hi,
> > > > While trying to create new directory i recieve the following error
> > > > message:
> > > > "System.IO.DirectoryNotFoundException: Could not find a part of the
> path
> > > > "\\premfs16\sites".
> > > > The path exists, even when i check the path
> > > > with the code: Directory.Exists(...) the result is true.
> > > > > > Here is the code:
> > > > http://www.adeo.co.il/test.aspx
> > > > > > Notice that in the line before the code throws exception
> > > > i create new file to the same path and no error
> > > > occurs - only when trying to create directory
> > > > the error appears.
> > > > > > Any idea?
> > > > > >
Well, I don't think you need read permissions for the root directory, only
for those under yours. Speak to your host and ask again on security
newsgroups.

Good luck,

Eliyahu

"?? ???" <@.discussions.microsoft.com> wrote in message
news:064E4D9D-5536-4DFD-A83D-6B9957ED5BFE@.microsoft.com...
> The problem is much more sophisticated.
> My web site host at shared hosting company.
> No hosting company will allow users to have read
> permissions on their root directory.
> So what you are actually saying is that you can not
> open directories on web sites which hosts on shared servers.
> Is that correct?
> "Eliyahu Goldin" wrote:
> > Yoni,
> > Probably file creating doesn't require read permission but directory
> > creating does. I don't know exactly how all these permissions work.
> > Security and permission setting is a complicated matter. You don't
really
> > need to understand fully the theoretical background. For your immediate
> > problem it's enough to know how other people solved the same problem. If
you
> > wish to investigate - you are welcome to invest your time in that.
> > Eliyahu
> > "?? ???" <@.discussions.microsoft.com> wrote in message
> > news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> > > So how do you explain that the code succeeded creating
> > > a file (which needs to read the same path...) and only
> > > creating a directory failed?
> > > > "Eliyahu Goldin" wrote:
> > > > > Yoni,
> > > > > > This is a security problem. You need to grant read permission for
> > > > \\premfs16\sites to the ASP.NET user.
> > > > > > Eliyahu
> > > > > > "?? ???" <@.discussions.microsoft.com> wrote in message
> > > > news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > > > > Hi,
> > > > > While trying to create new directory i recieve the following error
> > > > > message:
> > > > > "System.IO.DirectoryNotFoundException: Could not find a part of
the
> > path
> > > > > "\\premfs16\sites".
> > > > > The path exists, even when i check the path
> > > > > with the code: Directory.Exists(...) the result is true.
> > > > > > > > Here is the code:
> > > > > http://www.adeo.co.il/test.aspx
> > > > > > > > Notice that in the line before the code throws exception
> > > > > i create new file to the same path and no error
> > > > > occurs - only when trying to create directory
> > > > > the error appears.
> > > > > > > > Any idea?
> > > > > > > > >

Please help - weird problem

Hi,
While trying to create new directory i recieve the following error
message:
"System.IO.DirectoryNotFoundException: Could not find a part of the path
"\\premfs16\sites".
The path exists, even when i check the path
with the code: Directory.Exists(...) the result is true.
Here is the code:
http://www.adeo.co.il/test.aspx
Notice that in the line before the code throws exception
i create new file to the same path and no error
occurs - only when trying to create directory
the error appears.
Any idea?Yoni,
This is a security problem. You need to grant read permission for
\\premfs16\sites to the ASP.NET user.
Eliyahu
"' '?" <@.discussions.microsoft.com> wrote in message
news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> Hi,
> While trying to create new directory i recieve the following error
> message:
> "System.IO.DirectoryNotFoundException: Could not find a part of the path
> "\\premfs16\sites".
> The path exists, even when i check the path
> with the code: Directory.Exists(...) the result is true.
> Here is the code:
> http://www.adeo.co.il/test.aspx
> Notice that in the line before the code throws exception
> i create new file to the same path and no error
> occurs - only when trying to create directory
> the error appears.
> Any idea?
>
So how do you explain that the code succeeded creating
a file (which needs to read the same path...) and only
creating a directory failed?
"Eliyahu Goldin" wrote:

> Yoni,
> This is a security problem. You need to grant read permission for
> \\premfs16\sites to the ASP.NET user.
> Eliyahu
> "' '?" <@.discussions.microsoft.com> wrote in message
> news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
>
>
Yoni,
Probably file creating doesn't require read permission but directory
creating does. I don't know exactly how all these permissions work.
Security and permission setting is a complicated matter. You don't really
need to understand fully the theoretical background. For your immediate
problem it's enough to know how other people solved the same problem. If you
wish to investigate - you are welcome to invest your time in that.
Eliyahu
"' '?" <@.discussions.microsoft.com> wrote in message
news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> So how do you explain that the code succeeded creating
> a file (which needs to read the same path...) and only
> creating a directory failed?
> "Eliyahu Goldin" wrote:
>
path
The problem is much more sophisticated.
My web site host at shared hosting company.
No hosting company will allow users to have read
permissions on their root directory.
So what you are actually saying is that you can not
open directories on web sites which hosts on shared servers.
Is that correct?
"Eliyahu Goldin" wrote:

> Yoni,
> Probably file creating doesn't require read permission but directory
> creating does. I don't know exactly how all these permissions work.
> Security and permission setting is a complicated matter. You don't really
> need to understand fully the theoretical background. For your immediate
> problem it's enough to know how other people solved the same problem. If y
ou
> wish to investigate - you are welcome to invest your time in that.
> Eliyahu
> "' '?" <@.discussions.microsoft.com> wrote in message
> news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> path
>
>
Well, I don't think you need read permissions for the root directory, only
for those under yours. Speak to your host and ask again on security
newsgroups.
Good luck,
Eliyahu
"' '?" <@.discussions.microsoft.com> wrote in message
news:064E4D9D-5536-4DFD-A83D-6B9957ED5BFE@.microsoft.com...
> The problem is much more sophisticated.
> My web site host at shared hosting company.
> No hosting company will allow users to have read
> permissions on their root directory.
> So what you are actually saying is that you can not
> open directories on web sites which hosts on shared servers.
> Is that correct?
> "Eliyahu Goldin" wrote:
>
really
you
the

Saturday, March 24, 2012

Please help ! Problem about HttpWebRequest - GetResponse()

Hi,
The problem is that your proxy is not allowing the webrequest.
Do one thing create a webproxy object with your proxy name and port and
bind it to webrequest like this.
// True is to by pass proxy for local
WebProxy proxy = new WebProxy(name:port, true);
// suppose req is HttpWebRequest object
req.Proxy = proxy;
and then user req.getResponse method to get the response.
Regards,
AngrezHi singh_angrez,
Thank you for your suggestion. But I can test it in next 2 day after this
wend. After I try I will report the result again if it can solve my
problem or not
Thank you very much
Jap.
Hi singh_angrez,
Before I try your suggestion. I wanna show you about my code.
And my server architecture is like this
Web server --httprequest call to --> My service server
Actually, If my service server reponse the result to me in a short time,
everything is ok..no exception. But anytime my service server take long
time to process and send me the result.. at that time if there are many
requests from web server call to my service server, I got that exception
until my service server have a good response.
This is my code now. May be my code is not correct about HttpWebRequest
property.
//==== set ssl connection ==
ServicePointManager.CertificatePolicy = new MyPolicy();
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create
(PAYMENTGATEWAY_URL+strParam.ToString());
objRequest.Method = "GET";
//==== add new code ==
objRequest.KeepAlive = false;
objRequest.ProtocolVersion=HttpVersion.Version10;
objRequest.Proxy = System.Net.WebProxy.GetDefaultProxy(); // I use
default proxy which work well in normal time.
objRequest.AllowAutoRedirect=true;
objRequest.MaximumAutomaticRedirections=10;
objRequest.Timeout = (int) new TimeSpan(0,0,HTTPTIMEOUT)
.TotalMilliseconds; // ,HTTPTIMEOUT = 300
objRequest.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";
//==== add new code ==
string str = null;
HttpWebResponse objResponse;
StreamReader sr = null;
try
{
objResponse = (HttpWebResponse)objRequest.GetResponse();
}
catch( Exception e)
{
EventMgmt.EventExceptionMsg("Payment Gateway-GetResponse() =>
"+e.ToString(), @."\DataAccess\PGWException");
throw new ServiceException("PGW001","HOST_UNREACHABLE",e);
}
try
{
sr = new StreamReader(objResponse.GetResponseStream());
str = sr.ReadToEnd().Replace('\n'.ToString(),"").Replace('\t'.ToString()
,"").Replace('&'.ToString(),"");
}
catch( Exception e)
{
EventMgmt.EventExceptionMsg("Payment Gateway-ReadResponseStream() =>
"+e.ToString(), @."\DataAccess\PGWException");
throw new ServiceException("PGW003","READ_STREAM_ERROR",e);
}
finally
{
if( sr != null)
sr.Close();
objResponse.Close();
}
Thank you,
Jap.
the default setting for webclient is to only allow two connections to a
remote server. if you calls are slow, and they stack up, you will have
timeout problems. also you could hit your max thread pool sizes.
try upping the number of connections.
(httpRequest.ServicePoint.ConnectionLimit)
-- bruce (sqlwork.com)
"japslam japslam via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:1b2e8e50a4a5493bbb9004d9c3d2c1f0@.Do
webservertalk.com...
> Hi singh_angrez,
>
> Before I try your suggestion. I wanna show you about my code.
> And my server architecture is like this
> Web server --httprequest call to --> My service server
> Actually, If my service server reponse the result to me in a short time,
> everything is ok..no exception. But anytime my service server take long
> time to process and send me the result.. at that time if there are many
> requests from web server call to my service server, I got that exception
> until my service server have a good response.
> This is my code now. May be my code is not correct about HttpWebRequest
> property.
>
> //==== set ssl connection ==
> ServicePointManager.CertificatePolicy = new MyPolicy();
> HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create
> (PAYMENTGATEWAY_URL+strParam.ToString());
> objRequest.Method = "GET";
> //==== add new code ==
> objRequest.KeepAlive = false;
> objRequest.ProtocolVersion=HttpVersion.Version10;
> objRequest.Proxy = System.Net.WebProxy.GetDefaultProxy(); // I use
> default proxy which work well in normal time.
> objRequest.AllowAutoRedirect=true;
> objRequest.MaximumAutomaticRedirections=10;
> objRequest.Timeout = (int) new TimeSpan(0,0,HTTPTIMEOUT)
> .TotalMilliseconds; // ,HTTPTIMEOUT = 300
> objRequest.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";
> //==== add new code ==
> string str = null;
> HttpWebResponse objResponse;
> StreamReader sr = null;
> try
> {
> objResponse = (HttpWebResponse)objRequest.GetResponse();
> }
> catch( Exception e)
> {
> EventMgmt.EventExceptionMsg("Payment Gateway-GetResponse() =>
> "+e.ToString(), @."\DataAccess\PGWException");
> throw new ServiceException("PGW001","HOST_UNREACHABLE",e);
> }
> try
> {
> sr = new StreamReader(objResponse.GetResponseStream());
> str = sr.ReadToEnd().Replace('\n'.ToString(),"").Replace('\t'.ToString()
> ,"").Replace('&'.ToString(),"");
> }
> catch( Exception e)
> {
> EventMgmt.EventExceptionMsg("Payment Gateway-ReadResponseStream() =>
> "+e.ToString(), @."\DataAccess\PGWException");
> throw new ServiceException("PGW003","READ_STREAM_ERROR",e);
> }
> finally
> {
> if( sr != null)
> sr.Close();
> objResponse.Close();
> }
>
> Thank you,
> Jap.

please help .. with Microsoft webcontrols ..

I downloaded the IE Web controls package and as instructed ran the Build file which does create the build folder with a subfolder called runtime but I do not see any Microsoft.Web.UI.WebControls.dll being created anywhere in this folder. What is going on ?Open up your build.bat with notepad and make sure the path to
csc.exe is valid. see below example.

c:\windows\microsoft.net\framework\v1.1.4322\csc.exe

Also run build.bat from the DOS shell not the Run menu so you can see what is happening.
I downloaded the IE Web controls package

For the love of our lord Jesus Christ, why?

and as instructed ran the Build file which does create the build folder with a subfolder called runtime but I do not see any Microsoft.Web.UI.WebControls.dll being created anywhere in this folder. What is going on ?

Are you building through commandline, and when building, did you resolve the first 'error'? (THis might be entirely based on experience, but there is usually one error to resolve when you try to build it the first time
hey what do you have against the iewebcontrols... the tabstrip + multipage works ok. Do you know of any other tabbing control that's free that's better. It would make my life a lot easier.
Free? No.

Better? All of them.

The IE Web Controls are the equivalent of Windows Millennium. It works, but it really isn't that good. If I had been a little more dishonest, I could have given you my version of the same controls I wrote for my previous company... those controls are probably on sale somewhere right now. :(

please help , build datatable of FileUpload , or DataColumn , datatype of FileUpload

hello , I'm trying to create tatatable to store list of fileuploads to use them to patch upoad

my problem is to create the (DataColum)

this is my code

1DataTable My_Dt =new DataTable();23 DataColumn myDataColumn =new DataColumn("ColName", Type.GetType("System.Web.UI.WebControls.FileUpload",true));4 My_Dt.Columns.Add(myDataColumn);5
 It gives me error
/*****/ 
 Could not load type 'System.Web.UI.WebControls.FileUpload' from assembly 'App_Web_5dgo8bbt, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
 /******/
so anyone provide any help to do this ?
thanks in advance,. 
 

I don't think you can create a datacolumn with a datatype of FileUpload control.
If you are trying contain the file name, then all you need is a text column. Then, when populating your datatable, add in the string equivalent of the filename.
Hope this helps.


well, thank you rof your response

I got it

let me share it with you

DataTable My_Dt = new DataTable();
Type type = FileUpload1.GetType();//it's in my form
DataColumn myDataColumn = new DataColumn("ColName", type);
My_Dt.Columns.Add(myDataColumn);

I hope this helps you in future, lol

Please help = Im desparate

I come from a PHP background and I'm having a heck of a time solving this problem. I need to create a contact form/ shopping cart. The form will consist of:

1. Product info(orderForm.asp):
the customer will select products and the a form for personal info will be filled out - this will include name. address, credit cart info, etc

2. Confirm order (orderConfirm.asp):
the values of the customers products will be added up and sent to this page along with the info previousley filled in and the order is sent by encrypted email.

I have done this with PHP by declaring variables and using 'if then else' statements.

Anybody have any idea how I can achieve this. It has to be done yesterday

I am not sure what exactly you need here.

If you would like to know about sending mails from ASP.net, check this link (its explined with an example)

http://www.developer.com/net/asp/article.php/3096831


kevinritt:

I come from a PHP background and I'm having a heck of a time solving this problem. I need to create a contact form/ shopping cart. The form will consist of:

1. Product info(orderForm.asp):
the customer will select products and the a form for personal info will be filled out - this will include name. address, credit cart info, etc

2. Confirm order (orderConfirm.asp):
the values of the customers products will be added up and sent to this page along with the info previousley filled in and the order is sent by encrypted email.

I have done this with PHP by declaring variables and using 'if then else' statements.

Anybody have any idea how I can achieve this. It has to be done yesterday

kevinritt --

Check out these links...

ASP.NET Getting Started -- http://www.asp.net/getstarted/default.aspx?tabid=61

ASP.NET Quick Start Tutorials --http://quickstarts.asp.net/QuickStartv20/aspnet/Default.aspx

Learn ASP.NET --http://www.asp.net/learn/default.aspx?tabid=63

ASP.NET Starter Kits --http://www.asp.net/downloads/starterkits/default.aspx?tabid=62

One quick way to get your project done is to setup one of the eCommerce Starter Kit applications and then make it suit your needs. However, those are complex applications and may be beyond your level right now. If that is the case, then just study them a bit. Maybe.

In short, what you need is a web-application, 2 pages, and a database. You need (1) allow the user to enter data on Form1. (2) when the user submits the data on Form1, you will grab the data programmatically and put it in the database and then redirect to Form2; (3) on Form2, you will get the data from the database, put it on Form2, and show the email to be sent; (4) when the user submits Form2 you will send the data in the email.

That's some work, no doubt about it. You will need to know how to do (A) database access, (B) email sending, (C) navigation, and (D) page layout. Your best bet, I think, is to go through the QuickStarts and find the sections for A, B, C, and D, learn them, and then try to code it.

(A) Data Access --http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/default.aspx

(C) Navigation and (D) Page Layout --http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/default.aspx

(B) Email --http://www.developer.com/net/asp/article.php/3096831 orhttp://aspalliance.com/149_How_to_Send_Email_from_ASP_NET_

Is this is your 1st application, then it will take some time to get over the initial learning curve. However, after this application is done, I think you will see the power of ASP.NET over Classic ASP and PHP. IMHO.

HTH.

Thank you.

-- Mark Kamoski

Please help explain what an "application instance" really is in terms of static data

I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application and
I realize that static data is shared amongst child apps of an IIS
application and can be used by multiple users during the application life
cycle and for multiple page loads for the same or different page under a
root application.

What I don't understand and need to know is whether that static data would
be shared by ALL users of my application on a single server if my
application was loaded at all or whether it is possible to have my
application loaded multiple times such that each loading of my application
has its own set of static data that is potentially shared by multiple users.

Exactly what is an asp.net "application instance" in terms of windows
process, thread and object terminology which I understand well - is it a
user's sequenced use of the loaded assembly, concurrent thread usage of an
assembly or is it multiple loads of an assembly each of which can be used by
multiple users/threads?

As an analogy, let's say I write a multi threaded desktop app and allowed
multiple threads to use an object called X that was created by the main
thread. If that object X had static data then all threads in one process
that loaded my application would share that data in X even if each thread
had its own instance of X. But if I loaded 2 copies of my desktop
application (like running 2 copies of notepad.exe), each process would have
only one instance of object X static data no matter how many isntances of X
and each set of X static data would be shared by multiple threads in that
process but the staic data would not be shared between processes.

My concern is what scope I must lock at for all users of my asp.net
application on one machine. Can there be multiple copies of my static data?
One for each asp.net "application instance" or whether instance is just
referring to the fact that multiple users can be sharing the same static
data in the module that was loaded for the benefit of multiple users which I
believe I read are sequenced thru one at a time. Or do I really have to
worry about some users sharing one set of static data for one loading of my
application and another set of users sharing another set of static data
because my asp.net application was loaded again for them?

Hope I made myself clear. If I can have multiple sets of users each with
their own shared static data then I need to somehow lock across the multiple
copies of the static data.

So to summarize:

1. Can/must a C# lock be used for static data for ALL users on one machine -
depends if users are sequenced thru the application. Or is this totally
insufficient to protect a shared resource under asp.net?

2. Or rather must I somehow externally [like named semaphores] synchronize
across multiple application instances to protect that truly only one user at
a time on a given machine can modify a resource similar to what I would need
to do if I had multiple desktop processes running on one machine that had to
sequence use of a resource one at a time?

Whew...thanks!

Dave"static" means there is only one copy of the data. This is available to all
users of an application. If one user changes it, it is changed for all users.
You need to study the difference between the ASP.NET Application object vs.
what is "static" - they have similar features but are not the same thing. An
Application is a running instance of your web site in IIS, to put it in
simplest terms.

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com
"Dave" wrote:

Quote:

Originally Posted by

I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application and
I realize that static data is shared amongst child apps of an IIS
application and can be used by multiple users during the application life
cycle and for multiple page loads for the same or different page under a
root application.
>
What I don't understand and need to know is whether that static data would
be shared by ALL users of my application on a single server if my
application was loaded at all or whether it is possible to have my
application loaded multiple times such that each loading of my application
has its own set of static data that is potentially shared by multiple users.
>
Exactly what is an asp.net "application instance" in terms of windows
process, thread and object terminology which I understand well - is it a
user's sequenced use of the loaded assembly, concurrent thread usage of an
assembly or is it multiple loads of an assembly each of which can be used by
multiple users/threads?
>
As an analogy, let's say I write a multi threaded desktop app and allowed
multiple threads to use an object called X that was created by the main
thread. If that object X had static data then all threads in one process
that loaded my application would share that data in X even if each thread
had its own instance of X. But if I loaded 2 copies of my desktop
application (like running 2 copies of notepad.exe), each process would have
only one instance of object X static data no matter how many isntances of X
and each set of X static data would be shared by multiple threads in that
process but the staic data would not be shared between processes.
>
My concern is what scope I must lock at for all users of my asp.net
application on one machine. Can there be multiple copies of my static data?
One for each asp.net "application instance" or whether instance is just
referring to the fact that multiple users can be sharing the same static
data in the module that was loaded for the benefit of multiple users which I
believe I read are sequenced thru one at a time. Or do I really have to
worry about some users sharing one set of static data for one loading of my
application and another set of users sharing another set of static data
because my asp.net application was loaded again for them?
>
Hope I made myself clear. If I can have multiple sets of users each with
their own shared static data then I need to somehow lock across the multiple
copies of the static data.
>
So to summarize:
>
1. Can/must a C# lock be used for static data for ALL users on one machine -
depends if users are sequenced thru the application. Or is this totally
insufficient to protect a shared resource under asp.net?
>
>
2. Or rather must I somehow externally [like named semaphores] synchronize
across multiple application instances to protect that truly only one user at
a time on a given machine can modify a resource similar to what I would need
to do if I had multiple desktop processes running on one machine that had to
sequence use of a resource one at a time?
>
Whew...thanks!
>
Dave
>
>


static data is visible to all threads in the same ApplicationDomain. the
appdomain represents an instance of the clr vm. each app domain has its
own memory, stack, code and heap (gc).

an actually program can host more have more than one appdomain, and
appdomain can talk to each other, but only thru remoting (even if in the
same nt process).

with asp.net there is a worker process per application pool. you can
config asp.net to use one pool (process) or more.

when an asp.net application is defined in IIS (its bound to a vdir), you
assign it to the pool. when the asp.net application (i'll call website
because there are too many application references) is started, an
appdomain is created and its loaded into it. normally there is only one
appdomain per website. so statics are shared between all users (threads)
of that website.

but when a website recycle happens (code changed, too much memory,etc),
a new appdomain is started, and the old one is shut down. if there any
request using the old appdomain, they complete while new requests use
the new appdomain. they do not see each others statics.

this last issue becomes important if you are referencing a unmanaged
dll. the unmanaged dll is actually loaded into the worker process, so
any statics in it are shared across both appdomains and in fact all
other websites using the same pool.

just to confuse things a little, there is a Application object, which
global.asx represents. the instances of these are maintained in a pool,
as each request gets its on unique instance. (this is for performace
reasons beyond the scope of this over simplified explanation). this is
why there is are begin and end events, hooking to create/dispose would
happen too often.

your application statics may or may not need locking. application begin
fires and completes before any other request has access to the
application. so read only can safely be loaded during this event without
locks. if it a read/write resource and does not sync access on its own,
then you need to use locks. c# has a lock statement you can use.

this is different than session, which has serialized access, as only one
request is processed at a time that uses the same session. this allows
concurrent request, just not to the same session data. this would be too
limiting for application access, so you need locks.

note: the application cache has serialized access to the object, but
does not sync methods/property accesses. the object should be thread
safe, or again you need to use locks.

-- bruce (sqlwork.com)

Dave wrote:

Quote:

Originally Posted by

I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application
and I realize that static data is shared amongst child apps of an IIS
application and can be used by multiple users during the application
life cycle and for multiple page loads for the same or different page
under a root application.
>
What I don't understand and need to know is whether that static data
would be shared by ALL users of my application on a single server if my
application was loaded at all or whether it is possible to have my
application loaded multiple times such that each loading of my
application has its own set of static data that is potentially shared by
multiple users.
>
Exactly what is an asp.net "application instance" in terms of windows
process, thread and object terminology which I understand well - is it a
user's sequenced use of the loaded assembly, concurrent thread usage of
an assembly or is it multiple loads of an assembly each of which can be
used by multiple users/threads?
>
As an analogy, let's say I write a multi threaded desktop app and
allowed multiple threads to use an object called X that was created by
the main thread. If that object X had static data then all threads in
one process that loaded my application would share that data in X even
if each thread had its own instance of X. But if I loaded 2 copies of my
desktop application (like running 2 copies of notepad.exe), each process
would have only one instance of object X static data no matter how many
isntances of X and each set of X static data would be shared by multiple
threads in that process but the staic data would not be shared between
processes.
>
My concern is what scope I must lock at for all users of my asp.net
application on one machine. Can there be multiple copies of my static
data? One for each asp.net "application instance" or whether instance is
just referring to the fact that multiple users can be sharing the same
static data in the module that was loaded for the benefit of multiple
users which I believe I read are sequenced thru one at a time. Or do I
really have to worry about some users sharing one set of static data for
one loading of my application and another set of users sharing another
set of static data because my asp.net application was loaded again for
them?
>
Hope I made myself clear. If I can have multiple sets of users each with
their own shared static data then I need to somehow lock across the
multiple copies of the static data.
>
So to summarize:
>
1. Can/must a C# lock be used for static data for ALL users on one
machine - depends if users are sequenced thru the application. Or is
this totally insufficient to protect a shared resource under asp.net?
>
>
2. Or rather must I somehow externally [like named semaphores]
synchronize across multiple application instances to protect that truly
only one user at a time on a given machine can modify a resource similar
to what I would need to do if I had multiple desktop processes running
on one machine that had to sequence use of a resource one at a time?
>
Whew...thanks!
>
Dave
>


Thanks so much Bruce. This clears up several issues understanding more what
happens. I forgot since this is managed code that the framework can do
things within a windows process that unmanaged code cannot such as
isolation. If you could bear with me I need clarification on a few points:

1. Sounds like in the normal case, ALL users of a website application shares
static data since there the code is loaded into only one appdomain. But
there could be 2 or more appdomains running the code in the case of recycle,
configuring multiple pools or I'm guessing in the case of a web garden in
which case there would be multiple instances of my static data loaded with
some users assigned to one and others to another. Did I understand that
right?

2. I understand the unmanaged dll situation and is not a concern for me.

3. I'm confused on your description of the Application object as to each
user getting their own instance. I thought that object was shared by all
users of the application even if there could possibly be multiple appdomains
running that application as in the cases you mentioned. 'Course they do say
"Application Instance" which I think is at the root of my confusion. What is
meant by "instance" in this case?

4. If Application_Start runs when the application is loaded for the first
user, does it not have to finish before any other user enters the code? If
so then why would it matter if any sort of locking ws used or not for
readonly or readwrite resoruces? I probably misunderstood. Am unclear if
asp.net code has to be rentrant as I read once that users are serialized
thru an application but have my doubts as that would not scale very well.

5. Am also thinking that using "lock (static myobject)" would only work
within a single appdomain and that if in fact multiple appdomains had my
code loaded it would not serialize access amongst appdomains but only for
threads within an appdomain if for no other reason than that they had their
own copy of "myobject". Did you mean to say that somehow the C# lock would
work between appdomains or did I misunderstand?

6. Given, let's say, the possibility of multiple appdomains running the same
code wanting to update a file shared by all the child applications in an IIS
application, what would you recommend for synchronization so they don't step
on each other? A named semaphore or named mutex?

Thanks again,
Dave

"bruce barker" <nospam@.nospam.comwrote in message
news:OBMF2aAKIHA.4592@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

static data is visible to all threads in the same ApplicationDomain. the
appdomain represents an instance of the clr vm. each app domain has its
own memory, stack, code and heap (gc).
>
an actually program can host more have more than one appdomain, and
appdomain can talk to each other, but only thru remoting (even if in the
same nt process).
>
with asp.net there is a worker process per application pool. you can
config asp.net to use one pool (process) or more.
>
when an asp.net application is defined in IIS (its bound to a vdir), you
assign it to the pool. when the asp.net application (i'll call website
because there are too many application references) is started, an
appdomain is created and its loaded into it. normally there is only one
appdomain per website. so statics are shared between all users (threads)
of that website.
>
but when a website recycle happens (code changed, too much memory,etc), a
new appdomain is started, and the old one is shut down. if there any
request using the old appdomain, they complete while new requests use the
new appdomain. they do not see each others statics.
>
this last issue becomes important if you are referencing a unmanaged dll.
the unmanaged dll is actually loaded into the worker process, so any
statics in it are shared across both appdomains and in fact all other
websites using the same pool.
>
just to confuse things a little, there is a Application object, which
global.asx represents. the instances of these are maintained in a pool, as
each request gets its on unique instance. (this is for performace reasons
beyond the scope of this over simplified explanation). this is why there
is are begin and end events, hooking to create/dispose would happen too
often.
>
your application statics may or may not need locking. application begin
fires and completes before any other request has access to the
application. so read only can safely be loaded during this event without
locks. if it a read/write resource and does not sync access on its own,
then you need to use locks. c# has a lock statement you can use.
>
>
this is different than session, which has serialized access, as only one
request is processed at a time that uses the same session. this allows
concurrent request, just not to the same session data. this would be too
limiting for application access, so you need locks.
>
note: the application cache has serialized access to the object, but does
not sync methods/property accesses. the object should be thread safe, or
again you need to use locks.
>
>
-- bruce (sqlwork.com)
>
>
Dave wrote:

Quote:

Originally Posted by

>I have a global.asax file with Application_Start defined and create some
>static data there and in another module used in the asp.net application
>and I realize that static data is shared amongst child apps of an IIS
>application and can be used by multiple users during the application life
>cycle and for multiple page loads for the same or different page under a
>root application.
>>
>What I don't understand and need to know is whether that static data
>would be shared by ALL users of my application on a single server if my
>application was loaded at all or whether it is possible to have my
>application loaded multiple times such that each loading of my
>application has its own set of static data that is potentially shared by
>multiple users.
>>
>Exactly what is an asp.net "application instance" in terms of windows
>process, thread and object terminology which I understand well - is it a
>user's sequenced use of the loaded assembly, concurrent thread usage of
>an assembly or is it multiple loads of an assembly each of which can be
>used by multiple users/threads?
>>
>As an analogy, let's say I write a multi threaded desktop app and allowed
>multiple threads to use an object called X that was created by the main
>thread. If that object X had static data then all threads in one process
>that loaded my application would share that data in X even if each thread
>had its own instance of X. But if I loaded 2 copies of my desktop
>application (like running 2 copies of notepad.exe), each process would
>have only one instance of object X static data no matter how many
>isntances of X and each set of X static data would be shared by multiple
>threads in that process but the staic data would not be shared between
>processes.
>>
>My concern is what scope I must lock at for all users of my asp.net
>application on one machine. Can there be multiple copies of my static
>data? One for each asp.net "application instance" or whether instance is
>just referring to the fact that multiple users can be sharing the same
>static data in the module that was loaded for the benefit of multiple
>users which I believe I read are sequenced thru one at a time. Or do I
>really have to worry about some users sharing one set of static data for
>one loading of my application and another set of users sharing another
>set of static data because my asp.net application was loaded again for
>them?
>>
>Hope I made myself clear. If I can have multiple sets of users each with
>their own shared static data then I need to somehow lock across the
>multiple copies of the static data.
>>
>So to summarize:
>>
>1. Can/must a C# lock be used for static data for ALL users on one
>machine - depends if users are sequenced thru the application. Or is this
>totally insufficient to protect a shared resource under asp.net?
>>
>>
>2. Or rather must I somehow externally [like named semaphores]
>synchronize across multiple application instances to protect that truly
>only one user at a time on a given machine can modify a resource similar
>to what I would need to do if I had multiple desktop processes running on
>one machine that had to sequence use of a resource one at a time?
>>
>Whew...thanks!
>>
>Dave
>>


Bruce, would dearly love to hear your view on my response to this message.
This one was so helpful. THe doc is not very clear on these sort of issues
or on reentrancy either. Thanks, Dave

"bruce barker" <nospam@.nospam.comwrote in message
news:OBMF2aAKIHA.4592@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

static data is visible to all threads in the same ApplicationDomain. the
appdomain represents an instance of the clr vm. each app domain has its
own memory, stack, code and heap (gc).
>
an actually program can host more have more than one appdomain, and
appdomain can talk to each other, but only thru remoting (even if in the
same nt process).
>
with asp.net there is a worker process per application pool. you can
config asp.net to use one pool (process) or more.
>
when an asp.net application is defined in IIS (its bound to a vdir), you
assign it to the pool. when the asp.net application (i'll call website
because there are too many application references) is started, an
appdomain is created and its loaded into it. normally there is only one
appdomain per website. so statics are shared between all users (threads)
of that website.
>
but when a website recycle happens (code changed, too much memory,etc), a
new appdomain is started, and the old one is shut down. if there any
request using the old appdomain, they complete while new requests use the
new appdomain. they do not see each others statics.
>
this last issue becomes important if you are referencing a unmanaged dll.
the unmanaged dll is actually loaded into the worker process, so any
statics in it are shared across both appdomains and in fact all other
websites using the same pool.
>
just to confuse things a little, there is a Application object, which
global.asx represents. the instances of these are maintained in a pool, as
each request gets its on unique instance. (this is for performace reasons
beyond the scope of this over simplified explanation). this is why there
is are begin and end events, hooking to create/dispose would happen too
often.
>
your application statics may or may not need locking. application begin
fires and completes before any other request has access to the
application. so read only can safely be loaded during this event without
locks. if it a read/write resource and does not sync access on its own,
then you need to use locks. c# has a lock statement you can use.
>
>
this is different than session, which has serialized access, as only one
request is processed at a time that uses the same session. this allows
concurrent request, just not to the same session data. this would be too
limiting for application access, so you need locks.
>
note: the application cache has serialized access to the object, but does
not sync methods/property accesses. the object should be thread safe, or
again you need to use locks.
>
>
-- bruce (sqlwork.com)
>
>
Dave wrote:

Quote:

Originally Posted by

>I have a global.asax file with Application_Start defined and create some
>static data there and in another module used in the asp.net application
>and I realize that static data is shared amongst child apps of an IIS
>application and can be used by multiple users during the application life
>cycle and for multiple page loads for the same or different page under a
>root application.
>>
>What I don't understand and need to know is whether that static data
>would be shared by ALL users of my application on a single server if my
>application was loaded at all or whether it is possible to have my
>application loaded multiple times such that each loading of my
>application has its own set of static data that is potentially shared by
>multiple users.
>>
>Exactly what is an asp.net "application instance" in terms of windows
>process, thread and object terminology which I understand well - is it a
>user's sequenced use of the loaded assembly, concurrent thread usage of
>an assembly or is it multiple loads of an assembly each of which can be
>used by multiple users/threads?
>>
>As an analogy, let's say I write a multi threaded desktop app and allowed
>multiple threads to use an object called X that was created by the main
>thread. If that object X had static data then all threads in one process
>that loaded my application would share that data in X even if each thread
>had its own instance of X. But if I loaded 2 copies of my desktop
>application (like running 2 copies of notepad.exe), each process would
>have only one instance of object X static data no matter how many
>isntances of X and each set of X static data would be shared by multiple
>threads in that process but the staic data would not be shared between
>processes.
>>
>My concern is what scope I must lock at for all users of my asp.net
>application on one machine. Can there be multiple copies of my static
>data? One for each asp.net "application instance" or whether instance is
>just referring to the fact that multiple users can be sharing the same
>static data in the module that was loaded for the benefit of multiple
>users which I believe I read are sequenced thru one at a time. Or do I
>really have to worry about some users sharing one set of static data for
>one loading of my application and another set of users sharing another
>set of static data because my asp.net application was loaded again for
>them?
>>
>Hope I made myself clear. If I can have multiple sets of users each with
>their own shared static data then I need to somehow lock across the
>multiple copies of the static data.
>>
>So to summarize:
>>
>1. Can/must a C# lock be used for static data for ALL users on one
>machine - depends if users are sequenced thru the application. Or is this
>totally insufficient to protect a shared resource under asp.net?
>>
>>
>2. Or rather must I somehow externally [like named semaphores]
>synchronize across multiple application instances to protect that truly
>only one user at a time on a given machine can modify a resource similar
>to what I would need to do if I had multiple desktop processes running on
>one machine that had to sequence use of a resource one at a time?
>>
>Whew...thanks!
>>
>Dave
>>

Wednesday, March 21, 2012

Please help me create a list of all active sessions?

Can anyone give me a code example of how to use a global array to keep track
of
all active sessions (their sessionid, logontime, etc)?

I need a code example, not a prosa description of what to do..
Anyone..?

Best regards,
ChristinaChristina,

what you need to do is create a Singleton which has a internal collection or
an arraylist.
on session start. look up the user info you require and populate the
arraylist.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@.mail.please> wrote in message
news:urCG2rymEHA.2372@.TK2MSFTNGP10.phx.gbl...
> Can anyone give me a code example of how to use a global array to keep
> track
> of
> all active sessions (their sessionid, logontime, etc)?
> I need a code example, not a prosa description of what to do..
> Anyone..?
>
> Best regards,
> Christina
Yes, but HOW do I do that? I need a code example.
Can you help me?

Christina

"Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
news:ORAPxgzmEHA.3564@.tk2msftngp13.phx.gbl...
> Christina,
> what you need to do is create a Singleton which has a internal collection
or
> an arraylist.
> on session start. look up the user info you require and populate the
> arraylist.
> --
> Regards,
> Hermit Dave
> (http://hdave.blogspot.com)
> "Christina N" <no@.mail.please> wrote in message
> news:urCG2rymEHA.2372@.TK2MSFTNGP10.phx.gbl...
> > Can anyone give me a code example of how to use a global array to keep
> > track
> > of
> > all active sessions (their sessionid, logontime, etc)?
> > I need a code example, not a prosa description of what to do..
> > Anyone..?
> > Best regards,
> > Christina
writing a small example.. will post it shortly

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@.mail.com> wrote in message
news:OTD6go1mEHA.3712@.TK2MSFTNGP15.phx.gbl...
> Yes, but HOW do I do that? I need a code example.
> Can you help me?
>
> Christina
>
> "Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
> news:ORAPxgzmEHA.3564@.tk2msftngp13.phx.gbl...
> > Christina,
> > what you need to do is create a Singleton which has a internal
collection
> or
> > an arraylist.
> > on session start. look up the user info you require and populate the
> > arraylist.
> > --
> > Regards,
> > Hermit Dave
> > (http://hdave.blogspot.com)
> > "Christina N" <no@.mail.please> wrote in message
> > news:urCG2rymEHA.2372@.TK2MSFTNGP10.phx.gbl...
> > > Can anyone give me a code example of how to use a global array to keep
> > > track
> > > of
> > > all active sessions (their sessionid, logontime, etc)?
> > > > I need a code example, not a prosa description of what to do..
> > > Anyone..?
> > > > > Best regards,
> > > Christina
> >
i will start with a singleton snippet right now.. if you need any further
help you know what to do

using System;
using System.Collections;

public class CUserInfo
{
private string sessionID;
private DataTime sessionTimeStamp;

public CUserInfo(string Sessionid, DateTime SessionTS)
{
sessionID = SessionID;
sessionTimeStamp = SessionTS;
}

public string SessionID
{
get
{
return sessionID;
}
set
{
sessionID = value;
}
}

public DateTime SessionTimeStamp
{
get
{
return sessionTimeStamp;
}
set
{
sessionTimeStamp = value;
}
}
}

public class CSessionManager
{
private static CSessionManager _csmInstance = null;
private ArrayList _alContainer;

private CSessionManager()
{
_alContainer = new ArrayList();
}

public Static CSessionManager GetInstance()
{
if(_csmInstance == null)
{
_csmInstance = new CSessionMananger();
}
return _csmInstance;
}

public Static void AddUserInfo(CUserInfo cui)
{
// do your checks here. like is the info already present ?
_alContainer.Add(cui)
}

public static CUserInfo CurrentUserInfo
{
get
{
string sessionID = this.context.Session.SessionID;
foreach(CUserInfo csi in _alContainer)
{
if(csi.SessionTimeStamp == sessionID)
{
return csi;
break;
}
}
}
set
{
// find the item & update it or remove the item if found
_alContainer.Add(value);
}
}

// Add your public static methods that you wish to call
// say for example to query the SessionManager for count etc
}

Once you create this object you should have the access to same instance
every time you call
CSessionManager myCurrentInstance = CSessionManager.GetInstance();

note that with singleton to get an instance you call the static GetIstance
method and you do not use the new keyword.
Place it in your cache or application object and you should have access
everywhere.

now to add the user
use Global.asax and use the methof Session_Start
here you have access to context object to use it to get session ID

protected void Session_Start(Object sender, EventArgs e)
{
CUserInfo csi = new CUserInfo(this.context.Session.SessionID,
DateTime.Now());
CSessionManager csmanager = CSessionManager.GetInstance();
csmanager.AddUserInfo(csi);

// you should be able to get sessionID (though i never needed to use
session id in this way so am not 100%)
}

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@.mail.com> wrote in message
news:OTD6go1mEHA.3712@.TK2MSFTNGP15.phx.gbl...
> Yes, but HOW do I do that? I need a code example.
> Can you help me?
>
> Christina
>
> "Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
> news:ORAPxgzmEHA.3564@.tk2msftngp13.phx.gbl...
> > Christina,
> > what you need to do is create a Singleton which has a internal
collection
> or
> > an arraylist.
> > on session start. look up the user info you require and populate the
> > arraylist.
> > --
> > Regards,
> > Hermit Dave
> > (http://hdave.blogspot.com)
> > "Christina N" <no@.mail.please> wrote in message
> > news:urCG2rymEHA.2372@.TK2MSFTNGP10.phx.gbl...
> > > Can anyone give me a code example of how to use a global array to keep
> > > track
> > > of
> > > all active sessions (their sessionid, logontime, etc)?
> > > > I need a code example, not a prosa description of what to do..
> > > Anyone..?
> > > > > Best regards,
> > > Christina
> >

Please help me create a list of all active sessions?

Can anyone give me a code example of how to use a global array to keep track
of
all active sessions (their sessionid, logontime, etc)?
I need a code example, not a prosa description of what to do..
Anyone..?
Best regards,
ChristinaChristina,
what you need to do is create a Singleton which has a internal collection or
an arraylist.
on session start. look up the user info you require and populate the
arraylist.
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@.mail.please> wrote in message
news:urCG2rymEHA.2372@.TK2MSFTNGP10.phx.gbl...
> Can anyone give me a code example of how to use a global array to keep
> track
> of
> all active sessions (their sessionid, logontime, etc)?
> I need a code example, not a prosa description of what to do..
> Anyone..?
>
> Best regards,
> Christina
>
Yes, but HOW do I do that? I need a code example.
Can you help me?
Christina
"Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
news:ORAPxgzmEHA.3564@.tk2msftngp13.phx.gbl...
> Christina,
> what you need to do is create a Singleton which has a internal collection
or
> an arraylist.
> on session start. look up the user info you require and populate the
> arraylist.
> --
> Regards,
> Hermit Dave
> (http://hdave.blogspot.com)
> "Christina N" <no@.mail.please> wrote in message
> news:urCG2rymEHA.2372@.TK2MSFTNGP10.phx.gbl...
>
writing a small example.. will post it shortly
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@.mail.com> wrote in message
news:OTD6go1mEHA.3712@.TK2MSFTNGP15.phx.gbl...
> Yes, but HOW do I do that? I need a code example.
> Can you help me?
>
> Christina
>
> "Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
> news:ORAPxgzmEHA.3564@.tk2msftngp13.phx.gbl...
collection
> or
>
i will start with a singleton snippet right now.. if you need any further
help you know what to do
using System;
using System.Collections;
public class CUserInfo
{
private string sessionID;
private DataTime sessionTimeStamp;
public CUserInfo(string Sessionid, DateTime SessionTS)
{
sessionID = SessionID;
sessionTimeStamp = SessionTS;
}
public string SessionID
{
get
{
return sessionID;
}
set
{
sessionID = value;
}
}
public DateTime SessionTimeStamp
{
get
{
return sessionTimeStamp;
}
set
{
sessionTimeStamp = value;
}
}
}
public class CSessionManager
{
private static CSessionManager _csmInstance = null;
private ArrayList _alContainer;
private CSessionManager()
{
_alContainer = new ArrayList();
}
public Static CSessionManager GetInstance()
{
if(_csmInstance == null)
{
_csmInstance = new CSessionMananger();
}
return _csmInstance;
}
public Static void AddUserInfo(CUserInfo cui)
{
// do your checks here. like is the info already present ?
_alContainer.Add(cui)
}
public static CUserInfo CurrentUserInfo
{
get
{
string sessionID = this.context.Session.SessionID;
foreach(CUserInfo csi in _alContainer)
{
if(csi.SessionTimeStamp == sessionID)
{
return csi;
break;
}
}
}
set
{
// find the item & update it or remove the item if found
_alContainer.Add(value);
}
}
// Add your public static methods that you wish to call
// say for example to query the SessionManager for count etc
}
Once you create this object you should have the access to same instance
every time you call
CSessionManager myCurrentInstance = CSessionManager.GetInstance();
note that with singleton to get an instance you call the static GetIstance
method and you do not use the new keyword.
Place it in your cache or application object and you should have access
everywhere.
now to add the user
use Global.asax and use the methof Session_Start
here you have access to context object to use it to get session ID
protected void Session_Start(Object sender, EventArgs e)
{
CUserInfo csi = new CUserInfo(this.context.Session.SessionID,
DateTime.Now());
CSessionManager csmanager = CSessionManager.GetInstance();
csmanager.AddUserInfo(csi);
// you should be able to get sessionID (though i never needed to use
session id in this way so am not 100%)
}
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@.mail.com> wrote in message
news:OTD6go1mEHA.3712@.TK2MSFTNGP15.phx.gbl...
> Yes, but HOW do I do that? I need a code example.
> Can you help me?
>
> Christina
>
> "Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
> news:ORAPxgzmEHA.3564@.tk2msftngp13.phx.gbl...
collection
> or
>

Please help me create a simple page

Today i was creating my first page in asp.net and the very soon i realized that
microsoft products were not trustworthy i created a simple web form
with two text boxes and two labels/one label but when i created the solution
(build solution) see what is the IE displaying me in second screen shot

designed a simple login form

http://img171.imageshack.us/img171/6276/form1ts2.jpg

this is what it gave me as an output no web tools being displayed only one label i cant see the text box or any submit button i have seen the html code thats generated and its fine

http://img105.imageshack.us/img105/65/iepageid3.jpg

I am using Visual studio 2002 version and IIS v 5.1 no antivirus is running and
default website has been granted permission

can anyone please please help me out :) thankstry recompiling your project and then refreshing IE after you do so.

If there is still no change, then I suggest you uninstall zone alarm.

I had an issue with VS 2003 where zone alarm broke asp.net
Disabling it did't fix my issue, but when I fully uninstalled it, asp.net was working again.
thanks 4 the help buddy
no success now i need to reinstall zone alarm any more ideas do you think
i need to reinstall visual studio all over again because all other .aspx files i downloaded from net are running fine on IIS so IIS is problem free

ok its 1:09 night and i need a nap when i wake up I hope some good
person will surely help me out thanks

ASP.net took away this night :cry:
Well, the problem could be anything!!

Check in the HTML part that the <form> tag is present. Or check the visibility properties of the non-rendered controls.

Or just upload the project!!
you may also want to look into upgrading to using the 2.0 framework.

You can get a Visual Studio Web Developer Express for free here
http://msdn.microsoft.com/vstudio/express/vwd/

and this is very very similar to ASP.NET in VS 2002, except they improved a LOT of the things that were problems in the previous versions..

Visual Studio .NET 2002 was almost more of a beta for .NET than a full on programming language, most people moved quickly to 1.1 (2003) when that came out, and then to 2.0 (2005)

The fact that Microsoft gives you the express tools for free, makes it easier to upgrade to the newer version, because you don't have to shell out money for a good IDE.
thanks guys i think i need to reinstall the asp.net now but the problem with 2005 express version is that there is no

sqlconnection and oledbconnection object tool in the data tab of the toolbox
so i was not using it :wave:
http://msdn2.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

Run the aspnet_regiis tool. Your files don't seem to have 'registered' properly.

aspnet_regiis /i

Please help me to create button search...

plss,...i am very new in asp.net..?can someone help me how to create button search in form including coding can be search in ms access....::((Hello, have a look at the following, they might give you an idea on how to process:
1-Populating a Search Engine with a C# Spider
2-Internal Site Search Engine
Regards

Friday, March 16, 2012

Please Help me understand..

I want to create a page that pulls a specific record from a database based on the value passed from a Request.QueryString. If the value is not in the string then it uses a default value of 1(one). Here is what I have so far:

' Determine if a Content ID has been passed in the query string
' If so use it as a variable in our SQL string to grab content for the page
' Httpcontext.Request.Querystring("Content_id")

Sub BindHomeBodyData() ' GRAB CONTENT *************************

Const strSQL as String = "SELECT * FROM Content WHERE Content_ID = " & Httpcontext.Request.Querystring("Content_id")
Dim myCommand as New SqlCommand(strSQL, myConnection)
Dim myDA as New SqlDataAdapter()
myDA.SelectCommand = myCommand
Dim myDS as New DataSet()
myDA.Fill(myDS)
dlHomeBodyData.DataSource = myDS
dlHomeBodyData.DataBind()

End SubNot tested:

Dim Content_ID As Integer = 1

If Not IsNull(Request.QueryString("Content_id")) Then
Dim myRegEx As New RegEx("[^0-9]"), sContent As String = myRegEx.Replace(Request.QueryString("Content_id"), "")

If sContent <> "" Then
Content_ID = CInt(sContent)
End If
End If


to take what you have given me and place it into what I have. Sorry I am an extreme newbie. Here is what I have is there any way you could educate me here and show me how to write this out according to my example. Thanks a lot I appreciate it.

Sub BindHomeBodyData() ' GRAB CONTENT *************************

Const strSQL as String = "SELECT * FROM Content WHERE Content_ID = " & Httpcontext.Request.Querystring("Content_id")
Dim myCommand as New SqlCommand(strSQL, myConnection)
Dim myDA as New SqlDataAdapter()
myDA.SelectCommand = myCommand
Dim myDS as New DataSet()
myDA.Fill(myDS)
dlHomeBodyData.DataSource = myDS
dlHomeBodyData.DataBind()

End Sub

please help me!

hi all,
i wanna create a page which has two parts.
in the first part,i have header and menus and logo...
when i click on any thing in the firs part it shows the result
in the second part without any refresh in page.
could you please help me?
i would be apprecited any suggestion.

thanks


Even if you did do something like have panels and just toggled the visibility, it would still refresh the page because of postback

So I'm not sure if theres any method to change whats being displayed on an ASP.NET page without refresh from a postback.


Hi,
It seems you'll need to do all that in JavaScript, as there is presently no way to run .net languages on the client browser.
You could cheat a bit and put the right side content in an IFRAME sothat you could reload that one only. You'll need to get your handsdirty with even more javascript for this one, however.
John

two words. Java Script.

You can create <div></div> regions and set the display value to none or block. here is a start for you. you will have to create a button to fire the javascipt.

<script language="javascript">

function showView(divID){

document.getElementById('span1').style.dispaly = 'none';

document.getElementById('span2').style.display = 'none';

document.getElementById(divID).style.display = 'block';

}

<html>

<div id="span1" style="DISPLAY: none">Hello</div>

<div id="span2" style="DISPLAY: block">Good Bye</div>


You could also use IFRAMEs. When the user clicks on the selectedoption, it loads the selected page in the IFRAME. All you have to do isadd a target="<iframeName>" attribute to the anchor. Thecontainer page never needs to refresh.
Also,Javascript is one word.
Regards,
Sam

I stand corrected.

Hi All,
thanks for your suggestions,really i didn't know how to start?Wink [;)]
all of your solutions were useful and i used themGeeked [8-|]
AGAIN MANY MANY THANKS GUYSSmile [:)]

Please help on this annoying error

whenever I open a project or create a project, it give a error messege like
"microsoft development environment has encountered a problem and needs to close. we are sorry for the inconvenience." it asks me "send error report" or "don't send". when I click "don't send", it is closed. However, it opens single file. I reinstall VS.net alreday and there is no help.
PLEASE HELP!!!Hi,

The following article may be of use to you.

http://weblogs.asp.net/cflaat/archive/2003/07/24/51598.aspx

hope it helps.