Hi. i show articles names on default.aspx. when i click an article's nam, it will redirect to detay.aspx. i send info using querystring.
response.redirect(""detay.aspx?id="+artid+"&name="+artname);//artid is id of article and rtname is header of article.
i want this url to show like ../detay/{articlename}. for doing this, i try httphandler. but it gives error. My codes are:
how can i use this. Sorry but i can't success with it. i created a webhandler like below:
<%@ WebHandler Language="C#" Class="handler.Detay" %>
using System;
using System.Web;
using System.Web.UI;
using System.Web.Services;
namespace handler
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Detay : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string path = context.Request.Path;
int ind = path.LastIndexOf('.');
string newpath = path.Substring(0, ind);
string detayadi = context.Request.QueryString["adi"];
newpath = newpath + "/" + detayadi;
context.RewritePath(newpath);
IHttpHandler hnd = PageParser.GetCompiledPageInstance(newpath, null, context);
hnd.ProcessRequest(context);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
also web.config is set as you said. it gives error:
Could not load file or assembly 'handler' or one of its dependencies. Sistem belirtilen dosyayi bulamiyor.
Source Error:
Code
Line 8:
Line 9:
Line 10:
Line 11:
Line 12:
Code
0
Jean PaulRank #32 · 38.5K reputationPosted Jan 4, 2011, 2:40 AM EST
i send project but i could not find your mail adress on site. also i set path as you are saying before. Please change the path in config as following: path="*/detay/*"
In my machine it is working when i use url http://localhost:62078/detay/article1
and alsoi tried project you sent me.but i couldn't run on my computer.
Thanks again.
Jean PaulRank #32 · 38.5K reputationPosted Jan 3, 2011, 9:58 PM EST
Please change the path in config as following:
path="*/detay/*"
In my machine it is working when i use url "http://localhost:62078/detay/article1"
Regards,
Jean Paul
sadi25 reputationPosted Jan 3, 2011, 10:45 PM EST
Jean PaulRank #32 · 38.5K reputationPosted Jan 3, 2011, 11:03 PM EST
sadi25 reputationPosted Jan 3, 2011, 11:37 PM EST
<%@ WebHandler Language="C#" Class="handler.Detay" %>
using System;
using System.Web;
using System.Web.UI;
using System.Web.Services;
namespace handler
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Detay : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string path = context.Request.Path;
int ind = path.LastIndexOf('.');
string newpath = path.Substring(0, ind);
string detayadi = context.Request.QueryString["adi"];
newpath = newpath + "/" + detayadi;
context.RewritePath(newpath);
IHttpHandler hnd = PageParser.GetCompiledPageInstance(newpath, null, context);
hnd.ProcessRequest(context);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
also web.config is set as you said. it gives error:
Could not load file or assembly 'handler' or one of its dependencies. Sistem belirtilen dosyayi bulamiyor.
Source Error:
Jean PaulRank #32 · 38.5K reputationPosted Jan 4, 2011, 2:40 AM EST
sadi25 reputationPosted Jan 4, 2011, 3:34 AM EST
Line 8:
Also, Thanks for replies.
Jean PaulRank #32 · 38.5K reputationPosted Jan 4, 2011, 3:44 AM EST
You can try my web app attachment.
or
Give your sample project.. i will fix it.
sadi25 reputationPosted Jan 4, 2011, 4:35 AM EST
Please change the path in config as following:
path="*/detay/*"
In my machine it is working when i use url http://localhost:62078/detay/article1
and alsoi tried project you sent me.but i couldn't run on my computer.
Thanks again.