|
Hello all,
I currently have an httpmodule that extracts various information regarding the response that is being sent to the client. One thing I want to implement is a count of how many external files (.js or .css) are being included in the page. I have a regex function for this, but the problem I'm having is I can't quite figure out how to access the markup that is being sent to the client. Here's most of what I have so far:
public class ResponseSizeHttpModule : IHttpModule
{
public void Init(HttpApplication application)
{
if (Convert.ToBoolean(ConfigurationManager.AppSettings["CheckResponseSize"]) == true)
{
application.BeginRequest += new EventHandler(this.AddFilter);
application.EndRequest += new EventHandler(this.ResponseMessage);
}
}
private void AddFilter(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
application.Response.Filter = new CounterClass(application.Response.Filter);
}
private void ResponseMessage(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
long lPageSize = application.Response.Filter.Length;
long lRespLimit = Convert.ToInt64(ConfigurationManager.AppSettings["ResponseLimitBytes"]);
if (lPageSize > lRespLimit)
{
string strResponse = "";
int intNumIncludes = CountIncludes(strResponse);
}
}
private int CountIncludes(string strResponse)
{
Regex reScripts = new Regex(".js|.css", RegexOptions.IgnoreCase);
return reScripts.Matches(strResponse).Count;
}
public void Dispose(){}
}
The bolded part is where I'd like to try to do this. I'm pretty new to httpmodules and the like so any suggestions on more effective methods are welcome, as would any other help.
Thanks in advance!
-------------------
abort, retry, fail?
|
|
|
|
|
There's a technique used in this article[^] that is similar to what you're describing. See if that is useful to you.
|
|
|
|
|
That did get me closer; I now have the functionality I need but it required another filter and module. Now I just need to get them to play nice together. Thanks!
-------------------
abort, retry, fail?
|
|
|
|
|
Hi
how can i use exsisting webservice in my appliation?
thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
|
yeah, i already added the reference. when i run my appliation, it's opening in Temuri.org something... but i am unable to use this in my page. we need to write any code in our web page?
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
don't take offense, but do you understand what a webservice is? Are you expecting something on your page without calling it?
|
|
|
|
|
not at all. i understand a bit about webservice.
i created one webservice. i add the web reference.
next i wrote this on my page:
public partial class mymathserviceclient : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
proxyMyMathService.MyMathService proxyMS = new proxyMyMathService.MyMathService();
double x = Convert.ToDouble(txtX.Text);
double y = Convert.ToDouble(txtY.Text);
double result = proxyMS.AddNumbers(x, y);
txtResult.Text = result.ToString();
}
}
stiil the webservice is directly running on the tempuri.org.
thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi.
I have a web application, which runs on the server. The application supposed to access folder on the Intranet (provided by user), grab some files and read them. The problem I have is the security. Some folders on the Intranet are not accessible. What happens is when user provides directory address to my application I cannot access the folder due to access denied error. How can I go around that? In my web.config file I have set <identity impersonate="true"> but still it doesn't work.
Thank you,
|
|
|
|
|
alexfromto wrote: grab some files
Does that mean they're being uploaded?
|
|
|
|
|
The files will be created by user in pdf format. I need to grab all of them in the directory (specified by user to my web application) and read files data into the database. The problem I get is when user specifies directory he has certain access. The application I have doesn't have that access and cannot even see the directory provided.
|
|
|
|
|
My Application State is throwing a null reference exception, when it shouldn't be. Any ideas??
|
|
|
|
|
Are you using IIS in production? If so, did you migrate the entire project? Did you add an application name to the VD?
|
|
|
|
|
Yes, and I'll add that the site worked before I added multi threading.
|
|
|
|
|
What is the exact error message.
|
|
|
|
|
I don't have it with me, but it's throwing a nullreferenceexception whenever it tries to access a value in the Application Session.
|
|
|
|
|
Does it help to know that the server is running on Virtual PC?
|
|
|
|
|
Hi all
i am trying to use session that i set in a webservice
and read it from an aspx web page
both are on the same site.
i'm using the asp from webservice by
string reportHtml = "";
Session["name"] = "guy";
WebRequest webRequest = WebRequest.Create("http://localhost:2367/Business.Reports/Reports/Report.aspx");
WebResponse webResponse = webRequest.GetResponse();
StreamReader sReader = new StreamReader(webResponse.GetResponseStream(), Encoding.GetEncoding("windows-1255"));
reportHtml = sReader.ReadToEnd();
and in the aspx i'm trying to get the session
name=Session["name"];
please help me since i'm trying to manage it all day
thanks
|
|
|
|
|
New homework assignment? It's been posted here multiple times, you're late.
|
|
|
|
|
well...
can't you just give the answer or post me to it ?
or any other better answer?
guy
|
|
|
|
|
I understand how hard it must be to actually look through past posts. It's so time consuming, especially with a homework deadline.
|
|
|
|
|
try to search the keys "sessions and webservice"
there is no comments for this issue even without the aspx
i'v searched allday some documentation and nothing realy helpfull...
if you dont have the knowledge, well... why to answer...
have a nice day...
|
|
|
|
|
Hi folks,
I have to generate a PDF on a webpage which takes long time to load...
I am using a progress bar web custom control on this page to indicate progress...
But I get the error message "Server cannot set content type after HTTP headers have been sent"....
Without the progress bar the page just loads up fine...
Any ideas to get this resolved...
Thanks
Joel
JO
|
|
|
|
|
Are you trying to access the file using exact paths, or relative path?
|
|
|
|
|
i have tried using both ways:but there was the same result.
|
|
|
|