two issues of asp.net development

Today, got bothered by two issues when I was doing the asp.net development.

First, all of the sudden, the “~” symbol in my code did not work anymore after I did some modifications. For example, I have one line of code to re-direct the users to an error page (/MyApp/App_Include/ErrorPage.aspx) like the below.

Response.Redirect("~/App_Include/ErrorPage.aspx?aspxerrorpath=" & Me.Page.Request.Url.ToString(), True)

But when any errors raised in some web forms in the location of /MyApp/Forms/somepage.aspx, I could not be re-directed to the ErrorPage.aspx, instead I got a 404 page not found error. It seemed the system was trying to find /MyApp/Forms/~/App_Include/ErrorPage.aspx.

If I replaced “~/” with “../” then everything was OK. The same if I took off all querystring parameter(?errorpath) from the ErrorPage.aspx.

Solution:

I concluded that there was a problem to use “~/” if “http://…” exists in the querystring parameter. To avoid that, I would have to replace “Me.Page.Request.Url.ToString()” with “
Request.path.ToString()” which provides the path information without “http://” prefix. So the working code is

Response.Redirect("~/App_Include/ErrorPage.aspx?aspxerrorpath=" &
Request.path.ToString(), True)

Second issue is about the Crystal report viewer on the server. I did not do anything, but all of sudden all my Crystal Report asp.net pages did not work anymore. And the error message was:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I really wasted a lot of to figure out the cause and solution, but everything said on the Internet was not my situation. Anyhow, finally I found out my own solution:
Just reboot the DAMN server (or the IIS services) which is stupid, hi, it fixed the problem.

  • Share/Bookmark
Tags:

Related posts

0 Responses to “two issues of asp.net development”


  • No Comments

Leave a Reply



Get Adobe Flash playerPlugin by wpburn.com wordpress themes