使用asp.net在web.config中以编程方式添加网址映射标记 [英] Add Url Mapping tag programmatically in web.config using asp.net

查看:65
本文介绍了使用asp.net在web.config中以编程方式添加网址映射标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..朋友,我的web.config文件中包含以下标记

Hi.. Friends, I have the following tag in my web.config file

<urlMappings enabled="true">
			<add url="~/addemployee" mappedUrl="~/addemployee.aspx"/>
			<add url="~/Default" mappedUrl="~/Default.aspx"/>
			<add url="~/editeemployee" mappedUrl="~/editeemployee.aspx"/>
		</urlMappings>



问题是我想添加下一个标签



The problem is that I want to add next tag

<add url="~/empdetails" mappedUrl="~/empdetails.aspx"/> 



以编程方式,所以请给我一些想法,我该怎么做.

谢谢&问候
Parveen Rathi



programmatically, so please give me some idea how can I do this.

Thanks & Regards
Parveen Rathi

推荐答案

我不建议您为此修改Web.Config.如果您需要在运行时执行类似的操作,建议使用传统的URL重写.

在此处阅读:使用ASP.NET进行URL重写 [ MSDN:URL重写 [ URL路由 [
I would not suggest you to modify Web.Config for such thing. If you need to do something like this at runtime, I would suggest traditional URL Rewriting.

Read here: URL Rewriting with ASP.NET[^]
MSDN: URL Rewriting[^]

OR

Read about, In ASP.NET 4.0: URL Routing[^]


这篇关于使用asp.net在web.config中以编程方式添加网址映射标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆