Starr Duskk
asked on
Short URL suggestions
My client wants a url like this:
http://mywebsite.com/NameofClient
I use ASP.NET WEBFORMS, so please no MVC answers.
If I do:
http://mywebsite.com/NameofClient
It expects that to be a folder name and errors.
If I do it with the ? it works:
http://mywebsite.com?NameofClient
But the client says ?'s are too confusing.
Any suggestions?
Can this be done with MapHttpRoute in the global.asax and then redirect to the page I want?
http://mywebsite.com/NameofClient
I use ASP.NET WEBFORMS, so please no MVC answers.
If I do:
http://mywebsite.com/NameofClient
It expects that to be a folder name and errors.
If I do it with the ? it works:
http://mywebsite.com?NameofClient
But the client says ?'s are too confusing.
Any suggestions?
Can this be done with MapHttpRoute in the global.asax and then redirect to the page I want?
ASKER
ste5an,
I'll check into that.
the "samples on ee" link is broken.
I'll check into that.
the "samples on ee" link is broken.
ASKER
stefan,
I tried the below in my web.config
And it still pulls up the 404 built-in error, instead of a custom error page or redirecting.
how do I do the match url as a wild card type of thing? that if it contains /bsar
And also is my url correct? or does it need a tilde? will it do relative redirects?
I am running this from localhost right now.
Thanks!
I tried the below in my web.config
<rewrite>
<rules>
<rule name="Launch URL Redirect" stopProcessing="true">
<match url="/bsar" />
<action type="Redirect" url="/mysubdir/Launch.aspx" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
And it still pulls up the 404 built-in error, instead of a custom error page or redirecting.
how do I do the match url as a wild card type of thing? that if it contains /bsar
And also is my url correct? or does it need a tilde? will it do relative redirects?
I am running this from localhost right now.
Thanks!
This is probably overkill, but you can write your own ISAPI.
https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524338(v%3Dvs.90)
Creating ISAPI Extensions
https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524338(v%3Dvs.90)
Creating ISAPI Extensions
if (urlString.Find("YourTrigger") != -1) //we want to redirect this file
{
urlString.Replace("YourTrigger","NameofClient");
char *newUrlString= urlString.GetBuffer(urlString.GetLength());
pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
They can coexist and you can use both in parallel. So using MVC for the routing and web forms for the rest is possible (samples on EE andsample).