如何为ASP.NET C#网站创建引用网址 [英] How do I create referral url for ASP.NET C# website

查看:79
本文介绍了如何为ASP.NET C#网站创建引用网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我尝试为我的网站创建推荐链接时遇到了一些挑战。

我想要一些像www.mysitename.com/?ref=username这样的东西,但我的挑战是



1.如何生成推荐网址

2.如何在新用户使用推荐网址时制作他将被重定向到注册页面以在推荐网址下注册。



任何关于如何完成这项工作的想法都将受到欢迎。



我尝试了什么:



没有明确的想法,我需要帮助,我还是新的在C#中,我之前没遇到过。

Hello friends, I have been having a little challenge trying to create referral link for my website.
I want to have something like "www.mysitename.com/?ref=username" but my challenge is

1. How can I generate the referral url
2. How do I make it so that when new user use referral url he will be redirected to registration page to signup under the referral url.

any idea on how I can get this done will be welcome.

What I have tried:

Had no clear idea, I need help, I am still new in C#, I have not encountered that before.

推荐答案

引用:

1 。如何生成推荐网址

1. How can I generate the referral url





您提供的示例使用 QueryString 传递值。 URL 中的符号之后的内容是查询字符串,其中 ref 用户名





The example you provided uses QueryString to pass value. The stuff after the ? symbol in the URL is the query string where ref is the key and username is the value.

Quote:

2。我如何做到这一点,以便当新用户使用推荐网址时,他将被重定向到注册页面以在推荐网址下注册。

2. How do I make it so that when new user use referral url he will be redirected to registration page to signup under the referral url.





你会简单使用 Request 对象从 QueryString 中获取值。例如: Request.QueryString [key]



根据您的需要提供的简单示例如下:





You would simply use the Request object to get the value from the QueryString. For example: Request.QueryString["key"]

A quick example based on your need would be:

if(Request.QueryString["ref"] != null)
{
     //redirect to the sign-up page here
     //for ASP.NET WebForms you can do:

     Response.Redirect("~/Signup.aspx");

}


这篇关于如何为ASP.NET C#网站创建引用网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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