I was in a need to create HttpHandler. I also needed to use the session.
Here is my first attempt:
public class ChbHandler : IHttpHandler
{
#region IHttpHandler Members
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
HttpRequest req = context.Request;
HttpResponse resp = context.Response;
resp.Write("HttpHandler: Hello World!");
}
#endregion
}
In Here if you try to use the Session object you will not it is null. Why is that?
I googled a bit and found that in order to support session, your HttpHandler should inherit the
IRequiresSessionState or IReadOnlySessionState in order to have the session state in the context parameter (the one that is passed to the ProcessRequest() routine.
Luckilly both interfaces are just marker interfaces, meaning you are not required to implement any additional methods.
So something like this:
public class ChbHandler : IHttpHandler, IRequiresSessionState
{
#region IHttpHandler Members
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
HttpRequest req = context.Request;
HttpResponse resp = context.Response;
resp.Write("HttpHandler: Hello World!");
}
#endregion
}
Should work just fine for you.
The only change is : IRequiresSessionState in the list of Interfaces that the class will inherit.
All the stuff that bothers software developer in his everyday tasks.
Aug 1, 2009
Insignifficant inconvience in telerik radReports
This one is not a big deal but it would be good if there is a workaround.
When you create a new report and choose to create a new datasouce (Database in my case) - the classes will be created in the project root and not where the report is created.
I tried to find some option or something in order to be able to place the datasource in a different folder in my project but with no luck. The datasource was always created in the root of the project.
Here comes the Microsoft part - when you then try to move the classes in another folder (by dragging them in the solution explorer), Visual Studio seems to mess up the namespaces (although I am 99% sure I have moved classes accross the project and the result was I need to manually change the class namespace in order to reflect its path - for example I have been able to move classes from the root folder of the project to let's say a folder named Helpers and I needed to manually change the namespace from ProjectName.SomeClass to ProjectName.Helpers.SomeClass), just can't get it.
It may ofcourse be some of the endless options in the Visual Studio not checked :)
It's kind of pain when you have a large project and want to separate different files according to their role in the project.
When you create a new report and choose to create a new datasouce (Database in my case) - the classes will be created in the project root and not where the report is created.
I tried to find some option or something in order to be able to place the datasource in a different folder in my project but with no luck. The datasource was always created in the root of the project.
Here comes the Microsoft part - when you then try to move the classes in another folder (by dragging them in the solution explorer), Visual Studio seems to mess up the namespaces (although I am 99% sure I have moved classes accross the project and the result was I need to manually change the class namespace in order to reflect its path - for example I have been able to move classes from the root folder of the project to let's say a folder named Helpers and I needed to manually change the namespace from ProjectName.SomeClass to ProjectName.Helpers.SomeClass), just can't get it.
It may ofcourse be some of the endless options in the Visual Studio not checked :)
It's kind of pain when you have a large project and want to separate different files according to their role in the project.
Jul 29, 2009
radTextBox - get the client ID of the TextBox ...
As the radTextBox should be changing its behaviour depending on the mode in which the developer put it. It doesn't return the ID of the TextBox (I mean the input type="text" id) when you call something like:
rtb.ClientID.
So if you have a radTextBox with the name of
rtbName
You will need to say:
string.Format("{0}_text", rtbName.ClientID);
At least I couldn't find a property to return this information for me.
You can also write a simple extension to do the work for you. Something like:
public static string GetTextBoxID(this RadTextBox rtb)
{
return string.Format("{0}_text", rtb.ClientID);
}
So you can then call it like:
rtb.GetTextBoxID();
Hope it helps ...
rtb.ClientID.
So if you have a radTextBox with the name of
rtbName
You will need to say:
string.Format("{0}_text", rtbName.ClientID);
At least I couldn't find a property to return this information for me.
You can also write a simple extension to do the work for you. Something like:
public static string GetTextBoxID(this RadTextBox rtb)
{
return string.Format("{0}_text", rtb.ClientID);
}
So you can then call it like:
rtb.GetTextBoxID();
Hope it helps ...
telerik radReporting, am I missing something?
I was playing with the radReporting tool. I had a datasource with 1 master item, which has about 2500 child data items.
I was trying to generate a master / detail report with the telerik radReporting.
Here is what I have so far.
First of all - using their videos is a great help. I had everything I needed in order to start.
Second - the designer is really great. I am not designer and it really pisses me off when I had to do any kind of design but with the deep Visual Studio integration and all those little yellow overlap indicators even a guy like me can do the report design.
But then the ultimate test came - the speed.
I want to clarify that I am in the begining and I am more like rookie in the telerik reporting and the reporting at all so it may be my mistake and not their. But I did follow a video to show me how to do the master / details report and I feel I did everything as it was on the video so I was expecting some performance.
Unfortunatelly with the configuration above - 1 master item and about 2500 detail items I had to wait about 5-6 minutes for the report being generated as HTML in the report viewer.
It's OK, I can live with that. There is a lot of data, their matrixes are complex and it takes time to do all the calculations. So 5-6 minutes are OK. Then I selected Rich Text format from the export type dropdown to export my report to an RTF. I was expecting it to pass with the same speed or a bit slower but it took about 25 minutes to load. And sometimes the system was going in out of memory exception...
I wrote my own RTF epxort, which wasn't using telerik radReporting designer but some generations I did instead. I was the one to care about the overall layout. And guess what?
With the remakrs made above (that I need to manually create a class for the report and do the matrixes my way) it took about 10 - 15 SECONDS to load the report. This is about 150 TIMES faster.
When I managed to get a report from the telerik radReportViewer (I needed few tries until the server was in a good enough mood to provide me with one :) it was about 10 MB, while mine which is minimized and set up for just that layout was about 1 MB.
Again - I don't blame telerik as I am not quite sure if I did everything right when I was generating the reports with their designer. I am just learning how to walk in the field of reporting so I may be missing way too much things.
I can only check that my data is comming in 2-3 seconds (so it is not a slow DB issue I guess).
If I am right I may be having an idea that may be considered by them to speed up the performance. I am also now looking if I can connect to some event or override some method that will let me inject my reporting solution instead using their.
If I find a way to do this I will write another post.
If not - I will use telerik radReporting only to open the HTML report in the report viewer and replace the RTF generation with mine so the user can be happy.
Anyone who has some remarks / ideas / help is welcome to comment this post.
I was trying to generate a master / detail report with the telerik radReporting.
Here is what I have so far.
First of all - using their videos is a great help. I had everything I needed in order to start.
Second - the designer is really great. I am not designer and it really pisses me off when I had to do any kind of design but with the deep Visual Studio integration and all those little yellow overlap indicators even a guy like me can do the report design.
But then the ultimate test came - the speed.
I want to clarify that I am in the begining and I am more like rookie in the telerik reporting and the reporting at all so it may be my mistake and not their. But I did follow a video to show me how to do the master / details report and I feel I did everything as it was on the video so I was expecting some performance.
Unfortunatelly with the configuration above - 1 master item and about 2500 detail items I had to wait about 5-6 minutes for the report being generated as HTML in the report viewer.
It's OK, I can live with that. There is a lot of data, their matrixes are complex and it takes time to do all the calculations. So 5-6 minutes are OK. Then I selected Rich Text format from the export type dropdown to export my report to an RTF. I was expecting it to pass with the same speed or a bit slower but it took about 25 minutes to load. And sometimes the system was going in out of memory exception...
I wrote my own RTF epxort, which wasn't using telerik radReporting designer but some generations I did instead. I was the one to care about the overall layout. And guess what?
With the remakrs made above (that I need to manually create a class for the report and do the matrixes my way) it took about 10 - 15 SECONDS to load the report. This is about 150 TIMES faster.
When I managed to get a report from the telerik radReportViewer (I needed few tries until the server was in a good enough mood to provide me with one :) it was about 10 MB, while mine which is minimized and set up for just that layout was about 1 MB.
Again - I don't blame telerik as I am not quite sure if I did everything right when I was generating the reports with their designer. I am just learning how to walk in the field of reporting so I may be missing way too much things.
I can only check that my data is comming in 2-3 seconds (so it is not a slow DB issue I guess).
If I am right I may be having an idea that may be considered by them to speed up the performance. I am also now looking if I can connect to some event or override some method that will let me inject my reporting solution instead using their.
If I find a way to do this I will write another post.
If not - I will use telerik radReporting only to open the HTML report in the report viewer and replace the RTF generation with mine so the user can be happy.
Anyone who has some remarks / ideas / help is welcome to comment this post.
Subscribe to:
Posts (Atom)