ASP.NET MVC越来越URL呼叫 [英] ASP.NET MVC getting calling URL

查看:109
本文介绍了ASP.NET MVC越来越URL呼叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个ASP.NET MVC应用4,我想获得该网站调用该应用程序的URL。也就是说,我希望能够改变稍微取决于哪个URL是从所谓的网站,因此需要知道如何告诉调用网址是什么?然后,我会打电话取决于哪个网站是从一个叫不同index.cshtml文件。

In an ASP.NET MVC 4 application, I would like to get the URL of the site calling the application. That is, I would like to be able to change the web site slightly depending upon which URL it is called from, and as such need to know how to tell what the calling URL is? I would then call a different index.cshtml file depending on which site it is called from.

任何帮助将AP preciated

Any help would be appreciated

推荐答案

我不能完全确定你想做的事,但这个会做的伎俩为您提供:

I'm not completely sure what you want to do, but would this do the trick for you:

Request.UrlReferrer

或者

Request.ServerVariables["HTTP_Referer"]

虽然我preFER第一位的。

Although I'd prefer the first one.

这篇关于ASP.NET MVC越来越URL呼叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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