Last post May 16, 2008 06:34 AM by SheoNarayan
Apr 12, 2008 06:28 AM|SheoNarayan|LINK
Hi, I am getting following error "Could not load type 'MyFunda.UrlHandlerForQuestion'." when I am creating any virtual directory and trying to access it.
My scenario is like that.
I have kept an application that has a UrlHanlder to handle all the request coming with path "/question/question*.aspx" and I have written its code into my App_Code folder like that.
<add verb="*" path="/questions/question*.aspx" type="MyFunda.UrlHandlerForQuestion"/>
/// HttpHanlder for Questions
public class UrlHandlerForQuestion : IHttpHandler
public void ProcessRequest(HttpContext context)
string strQuestionID = System.IO.Path.GetFileName(context.Request.RawUrl.ToString());
int len = strQuestionID.IndexOf(".");
int sep = 8;
len -= sep;
strQuestionID = strQuestionID.Substring(sep, len);
HttpContext.Current.Server.Transfer("~/questions/qa/questionShow.aspx?qid=" + strQuestionID + impFunctions.GetQueryStringOfURL(context.Request.RawUrl.ToString()));
//HttpContext.Current.Response.Redirect("~/questions/qa/questionShow.aspx?qid=" + strQuestionID);
public bool IsReusable
} // urlhandler for Question
In this way what I am doing is suppose if the url is /question/question1.aspx I am transferring to /question/qa/questionShow.aspx?qid=1
So my url will be like http://localhost/questions/question1.aspx
Above is working fine.
But When I try to host any other application on the same IIS after creating virtual directory (lets say /myfunda) like http://localhost/myfunda/default.aspx then I am getting following error "Could not load type 'MyFunda.UrlHandlerForQuestion'."
Apr 12, 2008 07:41 AM|ivanatanasov|LINK
try with put you code in other dll
and then reference this dll.
Apr 12, 2008 08:49 AM|SheoNarayan|LINK
I tried to keep my HttpHandler code into BAL (in my case UrlHanlder.cs file). Same error.
Apr 15, 2008 10:52 AM|ivanatanasov|LINK
asp.net didn't know you web site assembly and for this reason put this file in other class library
May 16, 2008 06:34 AM|SheoNarayan|LINK
I did that but couldn't solve the problem. :(