|
Hi All,
I got a work to upgrade existing asp.net code.
In this i came to see HttpContext,HttpResponse class.
Then I done research and found that it can be used to avoid querystring and can be used only for server.transfer.
Please let me know the exact use of httpcontext?
Thanks in advance.
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
|
|
This articles mentions using Context.Item to move information between froms when using Server.Transfer, however this techniques is very outdated and not recommended. Server.Transer(string, boolean)[^] should be used instead to preserve the forms collection and pass it along.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I have a Windows service which is hosting a WCF service and integration with an ASP.Net application. I have installed the service by using the installutil utility. But when I have tried to start the service in Services panel in the Control Panel. Its starting and stopping immediately.
Can anybody help me sarting the service and it should run untill I stop it manually. When I start it its giving me the below error.
"The CalculatorWindowsService service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs."
Please help me in this in any ways by giving any links or any sort advice any thing. Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis, MO - USA
|
|
|
|
|
It could be any number of reasons but without seeing any of the code you've used it would difficult to pinpoint. Perhaps an exception is being thrown? Perhaps you've coded to it stop after execution?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
Here is the code that I have written, can you please look at it and tell me where I am calling stop method when I am calling the start method. I am not doing it. Even if I remove the Console.WriteLine and Console.ReadLine also there is nothing differnce. Its giving the same message and stopping it. any sort of help is appreciated. This is the code in my service. If you need code from the IninitalizeComponent or from the ProjectInstaller I can give it here. Can you please help me in this I am new to the windows services.
public partial class MyNewService : ServiceBase
{
public MyNewService()
{
InitializeComponent();
if(!System.Diagnostics.EventLog.SourceExists("DoDyLogSourse"))
System.Diagnostics.EventLog.CreateEventSource("DoDyLogSourse","DoDyLog");
eventLog1.Source = "DoDyLogSourse";
eventLog1.Log = "DoDyLog";
}
protected override void OnStart(string[] args)
{
eventLog1.WriteEntry("my service started");
System.Console.WriteLine("my service started");
System.Console.ReadKey();
}
protected override void OnStop()
{
eventLog1.WriteEntry("my service stoped");
System.Console.WriteLine("my service stoped");
System.Console.ReadKey();
}
protected override void OnContinue()
{
eventLog1.WriteEntry("my service is continuing in working");
System.Console.WriteLine("my service is continuing in working");
System.Console.ReadKey();
}
protected override void OnPause()
{
eventLog1.WriteEntry("my service is Paused");
System.Console.WriteLine("my service is Paused");
System.Console.ReadKey();
}
protected override void OnShutdown()
{
eventLog1.WriteEntry("my service is Paused");
System.Console.WriteLine("my service is Paused");
System.Console.ReadKey();
}
}
Thanks & Regards,
Mohammad Abdul Aleem
St Louis, USA
|
|
|
|
|
your OnStart() needs to set the "hey i'm started flag" and then continue doing something until told to stop or pause by the OnStop() or OnPause()
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
Hi,
Thanks Ahmed for the reply.
Then I have two questions 1. how can I write on to a console application and then 2. how should I call stop method from start method
Means how can I control start and stop methods in Wnidows service or how can I make my windows service to execute for each 10 minutes.
Any link or any example would help please. Thanks in advance.
Thanks & Regards,
Mohammad Abdul Aleem
St Louis MO
|
|
|
|
|
there are many examples on codeproject of windows services. I suggest you type "windows service" in the above search box and do some reading...
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
Hi Ahmed,
I have searched all of them but no where I found to start my service and stop it till I say stop. I couldnt find this example. And is there any way that I can write the out put of the windows service in to console or file or on messagebox. I need this help.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
My suspicion here is that you've hit a permissions issue. Looking at your code, you've attempted to create an event source - if I'm right, your service does not have the permissions to manipulate the event log. Change the event source to write to Application instead.
|
|
|
|
|
Hi Pete,
Can you please help me and eloborate little bit, I am not getting any idea about I have been searching for it. How should I write to application instead of on the EvenLog. Any links or any sort of help would help me. Thanks in advance Pete.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
He meant write the to the Application Event Log, look at your event viewer.
Honestly it seems you need much more help than is possible here. Perhaps take a class at a local community college.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
Its writing some thing in even log, but I am not much familiar with writing in the event log. Its writing the following
The description for Event ID 0 from source CalculatorWindowsService cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Service cannot be started. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
at System.Console.ReadKey(Boolean intercept)
at System.Console.ReadKey()
at CalculatorWindowsServiceAppl.CalculatorWindowsService.OnStart(String[] args) in D:\StatusMessage\CalculatorWindowsServiceAppl\CalculatorWindowsServiceAppl\CalculatorWindowsService.cs:line 26
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
The problem here is that you're trying to read from / write to the Console within a Service.
This is NOT possible.
Write to a file instead.
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
Yes it has resloved the problem. Thanks all of you.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi mates,
I have one textbox and one button. How can I use javascript not to trigger the buttons click event when the
enter key is pressed inside textbox?
<asp:TextBox ID="txtSearch" runat="server" AutoPostBack="true"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClientClick="window.open'TKSRCH.aspx','search','width=900,height=500,left=400,top=350,toolbar=0,status=0,resizable=0,')"/>
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
function onKeyPress()
{
return event.keyCode == '13' ? false : true;
}
<asp:TextBox ID="txtSearch" runat="server" AutoPostBack="true" onkeypress="onKeyPress()"></asp:TextBox>
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
thanks for you quick reply.
when i press button, a pop up window will show.
when i enter key in textbox, a pop up will not show.
how to put that code in here
return event.keyCode == '13' ? false : true;
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
modified on Sunday, January 23, 2011 9:24 PM
|
|
|
|
|
Just put it in your OnKeyPress() method. (I'll leave it to you to figure out where)...
if( event.keyCode == '13' ){ return false; }
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi
I need to send a large number of emails as newsletter in website using SMTP protocol. The barrier is the server runs out of memory and raises an exception when emails count is large. I use a loop that iterates through an array of emails and send them. Is there any method that can mitigate this constriction. emails count is more than 100000.
|
|
|
|
|
If you are working for a website with 100,000+ subscriptions to a newsletter, you probably work for a website that should have it's own smtp system setup to deal with this. If it doesn't, I'm a little concerned that this "newsletter" you speak of is really more of a "spamletter"...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
If the server is running out of memory than there isn't much you can do. Even if you dispose of the objects the GC is non-deterministic so it may not free any memory in time to prevent the problems. You could try multi-threading but it would still face the same memory constraint. Another options if available is to use two, or more, SMTP servers. Sending this many emails at once would be better handled by a bulk email service.
Also sending out that many emails at once you are risking your domain being blacklisted as a spammer.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Is there a way to make sending emails slower ? For example make it take 1 hour or more to send emails to alleviate the burden. Asynchronous or some sort of that technique .
|
|
|
|