Link to home
Start Free TrialLog in
Avatar of Manne
Manne

asked on

Url encoding in asp.net&c#

Hi, I want to code for the url encoding in asp.net(c#).My aim is for example my site is www.example.com/register.aspx.Iin Browser Url "register.aspx cannot show in users browser instead of that register.aspx user can see any encoded format.Please give the code and explain how?
Avatar of jondow
jondow
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi, not sure I completely understtod the question but this is how to url encode:

Server.UrlEncode("www.example.com/register.aspx")

Avatar of Manne
Manne

ASKER

i mean in browser user dont see the register.aspx in browser Address bar.
Encoding is not possible in the URL. But you can use other feature called "routing" which will hide the physical asp.net page and allowes you to customize the URL.

Below is the download:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=D5CDD637-AC85-4522-B8D5-D17B5B064614&displaylang=en

ASKER CERTIFIED SOLUTION
Avatar of Praveen Kumar
Praveen Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manne

ASKER

is Routing concept  available in .net 3.5 only?
Yes, URL routing was first time introduced in ASP.NET 3.5 SP1.
Avatar of Manne

ASKER


When iam trying url routing this error occur..

Server Error in '/url_rout' Application.
--------------------------------------------------------------------------------

The route handler 'RouteHandler' did not return an IHttpHandler from its GetHttpHandler() method.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The route handler 'RouteHandler' did not return an IHttpHandler from its GetHttpHandler() method.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[InvalidOperationException: The route handler 'RouteHandler' did not return an IHttpHandler from its GetHttpHandler() method.]
   System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +15588
   System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +81
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +216
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +120