Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Java script error when URL's modified in Application_EndRequest and Application_BeginRequest

Reply
Thread Tools

Java script error when URL's modified in Application_EndRequest and Application_BeginRequest

 
 
Wayne Sepega
Guest
Posts: n/a
 
      01-05-2006
In our web application we have a routine that will take a URL and encrypt
the query string portion of it. We are doing this in the Global.asax in
Application_EndRequest, we have done this in 1.1 and I am currently using
the same code in my 2.0 application.

protected void Application_BeginRequest(Object sender, EventArgs e)
{
Response.Filter = new UrlEncryptFilter(this.Response.Filter); // Encypts
any URL on the page that has a query string.

if (this.Request.QueryString["eqs"] != null) //Check to see if the if the
request URL was encoded.
{
// Unencrypt the query string
string queryString = Decode(this.Request.QueryString["eqs"]); //Decode
the request query string
Context.RewritePath(this.Request.Path, this.Request.PathInfo,
queryString);
}
}

protected void Application_EndRequest(Object sender, EventArgs e)
{
if (this.Response.RedirectLocation == null)
return;

string oldUrl = this.Response.RedirectLocation;

int i = oldUrl.IndexOf('?') + 1;
if (i > 0 && oldUrl.Length > i + 1)
Response.RedirectLocation = string.Concat(oldUrl.Substring(0, i),
"eqs=", Encode(oldUrl.Substring(i)));
}


If this code is in place when I pull up some, not all, forms in my web
application I receive the following error in the browser:

Line: 915
Char: 1
Error WebForm_SaveS croilPositionSubmit' is undeFined
Code: 0
URL: http://localhost/LoadAlerts/Alerts_Add.aspx

Line 915 contains:
theForm.submit = WebForm_SaveScrollPositionSubmit;


This occurs even if there isn't any thing to be encrypted on the page. I've
taken the resulting page and saved the source both encrypted and not
encrypted, when there are no links on the page to be encyrpted the source is
identical.

Any help would be appreciated. Let me know if I need to supply any further
information.
Thanks
Wayne Sepega


 
Reply With Quote
 
 
 
 
Wayne Sepega
Guest
Posts: n/a
 
      01-06-2006
After much time, effort and help from a co-worker, we've found the issue.



ASP.net 2.0 generates the following in my web page:

<script
src="/LoadAlerts/WebResource.axd?d=S462ZtHX1VAIPXUpdJLd4Q2&amp;t=63 2663465369687500"
type="text/javascript"></script>


<script
src="/LoadAlerts/WebResource.axd?d=7eM4r3f83vmLH-iLPspbfw2&amp;t=632663465369687500"
type="text/javascript"></script>


I have this in my global ASAX in the on begin request:



Response.Filter = new UrlEncryptFilter(this.Response.Filter);

When the page is loaded the above Scripts are requested, for some reason yet
unkown, the java script is striped by our filter. I'm going to add an if to
make sure that the requested page has an .aspx extention.



Thanks

Wayne


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 8.34 I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible? PerlFAQ Server Perl Misc 0 03-12-2011 11:00 AM
Application_EndRequest code move SM ASP .Net 0 02-07-2008 11:43 AM
Application_BeginRequest and Request.Params[] under Asp.net 2.0 tao lin ASP .Net 1 03-26-2006 10:47 PM
Catch WebMethod name and params in Application_BeginRequest Franck ASP .Net 1 10-04-2005 11:26 AM
Application_EndRequest Ryan ASP .Net 3 01-21-2004 11:12 AM



Advertisments