By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,965 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,965 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jan 5 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Jan 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.