Click here to Skip to main content
15,889,281 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionCrystal Report Problem Pin
M A A Mehedi Hasan3-Apr-07 20:02
M A A Mehedi Hasan3-Apr-07 20:02 
AnswerRe: Crystal Report Problem Pin
Tirthadip3-Apr-07 22:18
Tirthadip3-Apr-07 22:18 
Questionuser control Pin
Quest073-Apr-07 19:53
Quest073-Apr-07 19:53 
AnswerRe: user control Pin
Sandeep Akhare4-Apr-07 5:07
Sandeep Akhare4-Apr-07 5:07 
Questionurl in action Pin
iamdking3-Apr-07 19:43
iamdking3-Apr-07 19:43 
Questionhow to dinamically display links in DataGridView Pin
nikogamulin3-Apr-07 19:21
nikogamulin3-Apr-07 19:21 
AnswerRe: how to dinamically display links in DataGridView Pin
nikogamulin3-Apr-07 19:24
nikogamulin3-Apr-07 19:24 
Questionproblem in url rewriting Pin
NidhiKanu3-Apr-07 19:20
professionalNidhiKanu3-Apr-07 19:20 
There was some mistake in my previous question,pls consider new one:

for url rewriting i wrote following code in web.config

<configSections>
<!-- The <configSections> element must contain a <section> tag for the <RewriterConfig> section element.
The type of the section handler is RewriterConfigSerializerSectionHandler, which is responsible for
deserializing the <RewriterConfig> section element into a RewriterConfig instance... --><b></b>
<section name="RewriterConfig" type="URLRewriter.Rewriter,URLRewriter" />

</configSections>
<RewriterConfig>
<Rules>
<!-- Rules for Content Displayer -->
<RewriterRule>
<url>/urlrewriter/UserList\.aspx</url>
<rewrite>Userdefault.aspx</rewrite>
</RewriterRule>


</Rules >
</RewriterConfig>

Then i took one class file named Rewriter.cs in which i wrote this code:
namespace URLRewriter
{
public class Rewriter : IConfigurationSectionHandler
{
protected XmlNode _oRules = null;
protected Rewriter()
{
}
public string GetSubstitution(string zPath)
{
Regex oReg;

foreach (XmlNode oNode in _oRules.SelectNodes("Rules"))
{
oReg = new Regex(oNode.SelectSingleNode("url/text()").Value);
Match oMatch = oReg.Match(zPath);

if (oMatch.Success)
{
return oReg.Replace(zPath,
oNode.SelectSingleNode("rewrite/text()").Value);
}
}

return zPath;
}
public static void Process()
{

Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/RewriterConfig");

string zSubst = oRewriter.GetSubstitution(HttpContext.Current.Request.Path);

if (zSubst.Length > 0)
{
HttpContext.Current.RewritePath(zSubst);
}
}

#region Implementation of IConfigurationSectionHandler
public object Create(object parent, object configContext, XmlNode section)
{
_oRules = section;

// TODO: Compile all Regular Expressions

return this;
}
#endregion

}
}

And at last i add a glabal.asax file and wrote following code in this file:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
URLRewriter.Rewriter.Process();
}

But when i tried to run it,it gives an error i.e. Object reference not set to an instance of an object in Rewriter.cs at
Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/RewriterConfig");

Anybody help me...

Thanks in Advance.




Questionproblem in urk rewriting Pin
NidhiKanu3-Apr-07 19:08
professionalNidhiKanu3-Apr-07 19:08 
QuestionMicrosoft AJAX problem... Pin
Venkatesh Mookkan3-Apr-07 19:01
Venkatesh Mookkan3-Apr-07 19:01 
AnswerRe: Microsoft AJAX problem... Pin
Venkatesh Mookkan3-Apr-07 21:47
Venkatesh Mookkan3-Apr-07 21:47 
Questionerror creating control crystalreportsector. Pin
rutav3-Apr-07 19:00
rutav3-Apr-07 19:00 
Questionwhat is GUID ? Pin
siddisagar3-Apr-07 18:50
siddisagar3-Apr-07 18:50 
AnswerRe: what is GUID ? Pin
enjoycrack3-Apr-07 18:57
enjoycrack3-Apr-07 18:57 
QuestionNeed Answer Pin
siddisagar3-Apr-07 18:00
siddisagar3-Apr-07 18:00 
AnswerRe: Need Answer Pin
Colin Angus Mackay3-Apr-07 21:11
Colin Angus Mackay3-Apr-07 21:11 
Questionhelp me check my executescaler Pin
neodeaths3-Apr-07 17:50
neodeaths3-Apr-07 17:50 
AnswerRe: help me check my executescaler Pin
enjoycrack3-Apr-07 17:59
enjoycrack3-Apr-07 17:59 
GeneralRe: help me check my executescaler Pin
neodeaths3-Apr-07 18:46
neodeaths3-Apr-07 18:46 
GeneralRe: help me check my executescaler Pin
enjoycrack3-Apr-07 18:54
enjoycrack3-Apr-07 18:54 
GeneralRe: help me check my executescaler Pin
neodeaths3-Apr-07 19:37
neodeaths3-Apr-07 19:37 
AnswerRe: help me check my executescaler Pin
Venkatesh Mookkan3-Apr-07 18:52
Venkatesh Mookkan3-Apr-07 18:52 
GeneralRe: help me check my executescaler Pin
neodeaths3-Apr-07 19:11
neodeaths3-Apr-07 19:11 
GeneralRe: help me check my executescaler Pin
Venkatesh Mookkan3-Apr-07 19:42
Venkatesh Mookkan3-Apr-07 19:42 
GeneralRe: help me check my executescaler Pin
neodeaths3-Apr-07 20:10
neodeaths3-Apr-07 20:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.