我有网络表单项目,例如我的链接是www.qweqwe.com/setup.exe 如果我可以写url" www.qweqwe.com/setup.exe"文件正在自动下载。
我不想要这个,我需要下载会话。当会话[" scr"]是" Ok"时,我无法更改文件名。比我必须让。
(我将使用ClickOnce,但我不想从每个人那里下载)
提前感谢所有人
答案 0 :(得分:0)
//First check for Session Variable
if(Session["scr"]!=null)
{
//Now if you want file only downloaded by only some specific person then
if(Session["scr"].ToString()=="You Specific Session value")
{
//Here Your File download code
}
}
答案 1 :(得分:0)
构建用于下载文件的通用处理程序(ASHX)。
在var {StateNavigator} = Navigation;
var {RefreshLink} = NavigationReact;
var App = ({stateNavigator}) => (
<div>
<RefreshLink
navigationData={{page: 'page1'}}
stateNavigator={stateNavigator}>
Page 1
</RefreshLink>
<RefreshLink
navigationData={{page: 'page2'}}
stateNavigator={stateNavigator}>
Page 2
</RefreshLink>
<div id="page"></div>
</div>
)
var Page1 = ({id, stateNavigator}) => (
<div>
<h1>Page 1</h1>
<RefreshLink
navigationData={{id: 1}}
includeCurrentData={true}
stateNavigator={stateNavigator}>
Show Article
</RefreshLink>
{id ? <DetailPage id={id} /> : null}
</div>
);
var Page2 = ({id, stateNavigator}) => (
<div>
<h1>Page 2</h1>
<RefreshLink
navigationData={{id: 1}}
includeCurrentData={true}
stateNavigator={stateNavigator}>
Show Article
</RefreshLink>
{id ? <DetailPage id={id} /> : null}
</div>
);
var DetailPage = ({id}) => <h2>Article {id}</h2>
var stateNavigator = new StateNavigator([
{key: 'example', route: '+/{page?}+/articles/{id}', defaultTypes: {id: 'number'}}
]);
ReactDOM.render(
<App stateNavigator={stateNavigator} />,
document.getElementById('container'));
var pages = {
'page1' : Page1,
'page2' : Page2,
}
stateNavigator.states.example.navigated = (data) => {
var Page = pages[data.page];
if (Page) {
ReactDOM.render(
<Page id={data.id} stateNavigator={stateNavigator} />,
document.getElementById('page'));
}
};
stateNavigator.start();
方法中,您可以检查会话并提供文件。这是一个例子:
ProcessRequest
不要忘记在IIS中删除exe文件的MIME,以便没有人可以直接下载它。